[DEV] update to the new system

This commit is contained in:
Edouard DUPIN 2024-01-19 01:01:44 +01:00
parent d2128fcac8
commit 6210dfc16e
19 changed files with 359 additions and 361 deletions

View File

@ -6,8 +6,8 @@
<version>0.2.0</version> <version>0.2.0</version>
<properties> <properties>
<maven.compiler.version>3.1</maven.compiler.version> <maven.compiler.version>3.1</maven.compiler.version>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version> <maven.dependency.version>3.1.1</maven.dependency.version>
</properties> </properties>
<repositories> <repositories>

View File

@ -23,7 +23,7 @@ public class WebLauncherLocal extends WebLauncher {
if (true) { if (true) {
// for local test: // for local test:
ConfigBaseVariable.apiAdress = "http://0.0.0.0:18080/karideo/api/"; ConfigBaseVariable.apiAdress = "http://0.0.0.0:18080/karideo/api/";
ConfigBaseVariable.dbPort = "3307"; ConfigBaseVariable.dbPort = "3906";
} }
try { try {
super.migrateDB(); super.migrateDB();

View File

@ -19,8 +19,8 @@ import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.PATCH;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
@ -64,7 +64,7 @@ public class SeasonResource {
return DataAccess.insertWithJson(Season.class, jsonRequest); return DataAccess.insertWithJson(Season.class, jsonRequest);
} }
@PUT @PATCH
@Path("{id}") @Path("{id}")
@RolesAllowed("ADMIN") @RolesAllowed("ADMIN")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

View File

@ -19,8 +19,8 @@ import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.PATCH;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
@ -64,7 +64,7 @@ public class SeriesResource {
return DataAccess.insertWithJson(Series.class, jsonRequest); return DataAccess.insertWithJson(Series.class, jsonRequest);
} }
@PUT @PATCH
@Path("{id}") @Path("{id}")
@RolesAllowed("ADMIN") @RolesAllowed("ADMIN")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

View File

@ -18,8 +18,8 @@ import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.PATCH;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
@ -67,7 +67,7 @@ public class TypeResource {
return DataAccess.insertWithJson(Type.class, jsonRequest); return DataAccess.insertWithJson(Type.class, jsonRequest);
} }
@PUT @PATCH
@Path("{id}") @Path("{id}")
@RolesAllowed("ADMIN") @RolesAllowed("ADMIN")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

View File

@ -15,7 +15,7 @@ import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.PUT; import jakarta.ws.rs.PATCH;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
@ -51,7 +51,7 @@ public class UserMediaAdvancementResource {
public record MediaInformations( public record MediaInformations(
int time, int time,
float percent, float percent,
int count) {}; int count) {}
//@POST //@POST
//@Path("{id}") //@Path("{id}")
@ -71,9 +71,9 @@ public class UserMediaAdvancementResource {
public record MediaInformationsDelta( public record MediaInformationsDelta(
int time, int time,
float percent, float percent,
boolean addCount) {}; boolean addCount) {}
@PUT @PATCH
@Path("{id}") @Path("{id}")
@RolesAllowed("USER") @RolesAllowed("USER")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ -94,9 +94,7 @@ public class UserMediaAdvancementResource {
} }
LOGGER.info("{},{},{}", elem.time, elem.percent, elem.count); LOGGER.info("{},{},{}", elem.time, elem.percent, elem.count);
final int nbAfected = DataAccess.update(elem, elem.id, List.of("time", "percent", "count")); final int nbAfected = DataAccess.update(elem, elem.id, List.of("time", "percent", "count"));
// TODO: manage the fact that no element has been updated ... return DataAccess.get(UserMediaAdvancement.class, elem.id);
final UserMediaAdvancement ret = DataAccess.get(UserMediaAdvancement.class, elem.id);
return ret;
} }
@DELETE @DELETE

View File

@ -25,8 +25,8 @@ import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.PATCH;
import jakarta.ws.rs.POST; import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
@ -51,7 +51,7 @@ public class VideoResource {
return DataAccess.get(Media.class, id); return DataAccess.get(Media.class, id);
} }
@PUT @PATCH
@Path("{id}") @Path("{id}")
@RolesAllowed("ADMIN") @RolesAllowed("ADMIN")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

View File

@ -10,7 +10,7 @@ public class Migration20231015 extends MigrationSqlStep {
@Override @Override
public String getName() { public String getName() {
return "refactor creation and update time"; return "migration-2023-10-15: refactor creation and update time";
} }
public Migration20231015() { public Migration20231015() {

View File

@ -2,13 +2,13 @@ package org.kar.karideo.model;
import java.util.List; import java.util.List;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.Data; import org.kar.archidata.model.Data;
import org.kar.archidata.model.GenericDataSoftDelete; import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToMany;
@ -20,16 +20,16 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class Season extends GenericDataSoftDelete { public class Season extends GenericDataSoftDelete {
@Column(nullable = false, length = 0) @Column(nullable = false, length = 0)
@DataComment("Name of the media (this represent the title)") @Schema(description = "Name of the media (this represent the title)")
public String name; public String name;
@Column(length = 0) @Column(length = 0)
@DataComment("Description of the media") @Schema(description = "Description of the media")
public String description; public String description;
@Column(nullable = false) @Column(nullable = false)
@DataComment("series parent ID") @Schema(description = "series parent ID")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Series.class) @ManyToOne(fetch = FetchType.LAZY, targetEntity = Series.class)
public Long parentId; public Long parentId;
@DataComment("List of Id of the sopecific covers") @Schema(description = "List of Id of the sopecific covers")
@ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class)
public List<Long> covers = null; public List<Long> covers = null;
} }

View File

@ -2,13 +2,13 @@ package org.kar.karideo.model;
import java.util.List; import java.util.List;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.Data; import org.kar.archidata.model.Data;
import org.kar.archidata.model.GenericDataSoftDelete; import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToMany;
@ -20,16 +20,16 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class Series extends GenericDataSoftDelete { public class Series extends GenericDataSoftDelete {
@Column(nullable = false, length = 0) @Column(nullable = false, length = 0)
@DataComment("Name of the media (this represent the title)") @Schema(description = "Name of the media (this represent the title)")
public String name; public String name;
@Column(length = 0) @Column(length = 0)
@DataComment("Description of the media") @Schema(description = "Description of the media")
public String description; public String description;
@Column(nullable = false) @Column(nullable = false)
@DataComment("series parent ID") @Schema(description = "series parent ID")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Type.class) @ManyToOne(fetch = FetchType.LAZY, targetEntity = Type.class)
public Long parentId; public Long parentId;
@DataComment("List of Id of the sopecific covers") @Schema(description = "List of Id of the sopecific covers")
@ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class)
public List<Long> covers = null; public List<Long> covers = null;
} }

View File

@ -2,13 +2,13 @@ package org.kar.karideo.model;
import java.util.List; import java.util.List;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.Data; import org.kar.archidata.model.Data;
import org.kar.archidata.model.GenericDataSoftDelete; import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToMany;
@ -19,12 +19,12 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class Type extends GenericDataSoftDelete { public class Type extends GenericDataSoftDelete {
@Column(nullable = false, length = 0) @Column(nullable = false, length = 0)
@DataComment("Name of the media (this represent the title)") @Schema(description = "Name of the media (this represent the title)")
public String name; public String name;
@Column(length = 0) @Column(length = 0)
@DataComment("Description of the media") @Schema(description = "Description of the media")
public String description; public String description;
@DataComment("List of Id of the sopecific covers") @Schema(description = "List of Id of the sopecific covers")
@ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class)
public List<Long> covers = null; public List<Long> covers = null;
} }

View File

@ -1,11 +1,11 @@
package org.kar.karideo.model; package org.kar.karideo.model;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.GenericDataSoftDelete; import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.FetchType; import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
@ -16,20 +16,20 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class UserMediaAdvancement extends GenericDataSoftDelete { public class UserMediaAdvancement extends GenericDataSoftDelete {
@Column(nullable = false) @Column(nullable = false)
@DataComment("Foreign Key Id of the user") @Schema(description = "Foreign Key Id of the user")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = UserKarideo.class) @ManyToOne(fetch = FetchType.LAZY, targetEntity = UserKarideo.class)
public long userId; public long userId;
@Column(nullable = false) @Column(nullable = false)
@DataComment("Id of the media") @Schema(description = "Id of the media")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Media.class) @ManyToOne(fetch = FetchType.LAZY, targetEntity = Media.class)
public long mediaId; public long mediaId;
@Column(nullable = false) @Column(nullable = false)
@DataComment("Percent of admencement in the media") @Schema(description = "Percent of admencement in the media")
public float percent; public float percent;
@Column(nullable = false) @Column(nullable = false)
@DataComment("Number of second of admencement in the media") @Schema(description = "Number of second of admencement in the media")
public int time; public int time;
@Column(nullable = false) @Column(nullable = false)
@DataComment("Number of time this media has been read") @Schema(description = "Number of time this media has been read")
public int count; public int count;
} }

View File

@ -132,7 +132,7 @@ export class SeasonEditScene implements OnInit {
if (this.description === undefined) { if (this.description === undefined) {
data.description = null; data.description = null;
} }
this.seasonService.put(this.idSeason, data); this.seasonService.patch(this.idSeason, data);
} }
// At the drag drop area // At the drag drop area

View File

@ -167,7 +167,7 @@ export class SeriesEditScene implements OnInit {
if (this.description === undefined) { if (this.description === undefined) {
data.description = null; data.description = null;
} }
this.seriesService.put(this.idSeries, data); this.seriesService.patch(this.idSeries, data);
} }
// At the drag drop area // At the drag drop area

View File

@ -340,7 +340,7 @@ export class VideoEditScene implements OnInit {
} }
let tmpp = this.data.clone(); let tmpp = this.data.clone();
let self = this; let self = this;
this.videoService.put(this.idVideo, data) this.videoService.patch(this.idVideo, data)
.then((response3) => { .then((response3) => {
self.dataOri = tmpp; self.dataOri = tmpp;
self.updateNeedSend(); self.updateNeedSend();

View File

@ -126,8 +126,8 @@ export class GenericInterfaceModelDB {
return this.bdd.addAfterPost(this.serviceName, ret); return this.bdd.addAfterPost(this.serviceName, ret);
} }
put(id:number, data:any):any { patch(id: number, data: any): any {
let ret = this.http.putSpecific([this.serviceName, id], data); let ret = this.http.patchSpecific([this.serviceName, id], data);
return this.bdd.setAfterPut(this.serviceName, id, ret); return this.bdd.setAfterPut(this.serviceName, id, ret);
} }

View File

@ -83,8 +83,8 @@ export class GenericInterfaceModelDBv2<TYPE> {
return this.bdd.addAfterPost(this.serviceName, ret) as TYPE; return this.bdd.addAfterPost(this.serviceName, ret) as TYPE;
} }
put(id: number, data: object): TYPE { patch(id: number, data: object): TYPE {
let ret = this.http.putSpecific([this.serviceName, id], data); let ret = this.http.patchSpecific([this.serviceName, id], data);
return this.bdd.setAfterPut(this.serviceName, id, ret) as TYPE; return this.bdd.setAfterPut(this.serviceName, id, ret) as TYPE;
} }

View File

@ -28,7 +28,7 @@ export class AdvancementService extends GenericInterfaceModelDBv2<UserMediaAdvan
}); });
} }
updateTime(id: number, time: number, total: number, addCount: boolean) { updateTime(id: number, time: number, total: number, addCount: boolean) {
this.put(id, { this.patch(id, {
time: time, time: time,
percent: time / total, percent: time / total,
addCount: addCount addCount: addCount

@ -1 +1 @@
Subproject commit ea5a4f6b7537eb707916f4610bf79fbe86c6296f Subproject commit c3489422f2df7f16465b4358e868664af9cda81c