[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>
<properties>
<maven.compiler.version>3.1</maven.compiler.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version>
</properties>
<repositories>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,13 +2,13 @@ package org.kar.karideo.model;
import java.util.List;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.Data;
import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToMany;
@ -19,12 +19,12 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Type extends GenericDataSoftDelete {
@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;
@Column(length = 0)
@DataComment("Description of the media")
@Schema(description = "Description of the media")
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)
public List<Long> covers = null;
}

View File

@ -1,11 +1,11 @@
package org.kar.karideo.model;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToOne;
@ -16,20 +16,20 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserMediaAdvancement extends GenericDataSoftDelete {
@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)
public long userId;
@Column(nullable = false)
@DataComment("Id of the media")
@Schema(description = "Id of the media")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Media.class)
public long mediaId;
@Column(nullable = false)
@DataComment("Percent of admencement in the media")
@Schema(description = "Percent of admencement in the media")
public float percent;
@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;
@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;
}

View File

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

View File

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

View File

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

View File

@ -126,8 +126,8 @@ export class GenericInterfaceModelDB {
return this.bdd.addAfterPost(this.serviceName, ret);
}
put(id:number, data:any):any {
let ret = this.http.putSpecific([this.serviceName, id], data);
patch(id: number, data: any): any {
let ret = this.http.patchSpecific([this.serviceName, id], data);
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;
}
put(id: number, data: object): TYPE {
let ret = this.http.putSpecific([this.serviceName, id], data);
patch(id: number, data: object): TYPE {
let ret = this.http.patchSpecific([this.serviceName, id], data);
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) {
this.put(id, {
this.patch(id, {
time: time,
percent: time / total,
addCount: addCount

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