[DEV] update to the new system
This commit is contained in:
parent
d2128fcac8
commit
6210dfc16e
@ -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>
|
||||||
|
@ -7,9 +7,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
public class WebLauncherLocal extends WebLauncher {
|
public class WebLauncherLocal extends WebLauncher {
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(WebLauncherLocal.class);
|
private final static Logger LOGGER = LoggerFactory.getLogger(WebLauncherLocal.class);
|
||||||
|
|
||||||
private WebLauncherLocal() {}
|
private WebLauncherLocal() {}
|
||||||
|
|
||||||
public static void main(final String[] args) throws InterruptedException {
|
public static void main(final String[] args) throws InterruptedException {
|
||||||
final WebLauncherLocal launcher = new WebLauncherLocal();
|
final WebLauncherLocal launcher = new WebLauncherLocal();
|
||||||
launcher.process();
|
launcher.process();
|
||||||
@ -17,13 +17,13 @@ public class WebLauncherLocal extends WebLauncher {
|
|||||||
Thread.currentThread().join();
|
Thread.currentThread().join();
|
||||||
LOGGER.info("STOP the REST server:");
|
LOGGER.info("STOP the REST server:");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() throws InterruptedException {
|
public void process() throws InterruptedException {
|
||||||
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();
|
||||||
|
@ -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;
|
||||||
@ -31,20 +31,20 @@ import jakarta.ws.rs.core.Response;
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public class SeasonResource {
|
public class SeasonResource {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(SeasonResource.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(SeasonResource.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public static Season getWithId(@PathParam("id") final Long id) throws Exception {
|
public static Season getWithId(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Season.class, id);
|
return DataAccess.get(Season.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public List<Season> get() throws Exception {
|
public List<Season> get() throws Exception {
|
||||||
return DataAccess.gets(Season.class);
|
return DataAccess.gets(Season.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@ -52,19 +52,19 @@ public class SeasonResource {
|
|||||||
public Season get(@PathParam("id") final Long id) throws Exception {
|
public Season get(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Season.class, id);
|
return DataAccess.get(Season.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* ADMIN SECTION:
|
* ADMIN SECTION:
|
||||||
* ============================================================================= */
|
* ============================================================================= */
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Season put(final String jsonRequest) throws Exception {
|
public Season put(final String jsonRequest) throws Exception {
|
||||||
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)
|
||||||
@ -72,7 +72,7 @@ public class SeasonResource {
|
|||||||
DataAccess.updateWithJson(Season.class, id, jsonRequest);
|
DataAccess.updateWithJson(Season.class, id, jsonRequest);
|
||||||
return DataAccess.get(Season.class, id);
|
return DataAccess.get(Season.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -80,7 +80,7 @@ public class SeasonResource {
|
|||||||
DataAccess.delete(Season.class, id);
|
DataAccess.delete(Season.class, id);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}/add_cover")
|
@Path("{id}/add_cover")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -89,7 +89,7 @@ public class SeasonResource {
|
|||||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||||
return DataTools.uploadCover(Season.class, id, fileName, fileInputStream, fileMetaData);
|
return DataTools.uploadCover(Season.class, id, fileName, fileInputStream, fileMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}/rm_cover/{coverId}")
|
@Path("{id}/rm_cover/{coverId}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -97,7 +97,7 @@ public class SeasonResource {
|
|||||||
AddOnManyToMany.removeLink(Season.class, id, "cover", coverId);
|
AddOnManyToMany.removeLink(Season.class, id, "cover", coverId);
|
||||||
return Response.ok(DataAccess.get(Season.class, id)).build();
|
return Response.ok(DataAccess.get(Season.class, id)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Season getOrCreate(final String name, final Long seriesId) {
|
public static Season getOrCreate(final String name, final Long seriesId) {
|
||||||
try {
|
try {
|
||||||
Season out = DataAccess.getWhere(Season.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId))));
|
Season out = DataAccess.getWhere(Season.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId))));
|
||||||
@ -114,5 +114,5 @@ public class SeasonResource {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -31,20 +31,20 @@ import jakarta.ws.rs.core.Response;
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public class SeriesResource {
|
public class SeriesResource {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(SeriesResource.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(SeriesResource.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public static Series getWithId(@PathParam("id") final Long id) throws Exception {
|
public static Series getWithId(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Series.class, id);
|
return DataAccess.get(Series.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public List<Series> get() throws Exception {
|
public List<Series> get() throws Exception {
|
||||||
return DataAccess.gets(Series.class);
|
return DataAccess.gets(Series.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@ -52,19 +52,19 @@ public class SeriesResource {
|
|||||||
public Series get(@PathParam("id") final Long id) throws Exception {
|
public Series get(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Series.class, id);
|
return DataAccess.get(Series.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* ADMIN SECTION:
|
* ADMIN SECTION:
|
||||||
* ============================================================================= */
|
* ============================================================================= */
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Series put(final String jsonRequest) throws Exception {
|
public Series put(final String jsonRequest) throws Exception {
|
||||||
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)
|
||||||
@ -72,7 +72,7 @@ public class SeriesResource {
|
|||||||
DataAccess.updateWithJson(Series.class, id, jsonRequest);
|
DataAccess.updateWithJson(Series.class, id, jsonRequest);
|
||||||
return DataAccess.get(Series.class, id);
|
return DataAccess.get(Series.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -80,7 +80,7 @@ public class SeriesResource {
|
|||||||
DataAccess.delete(Series.class, id);
|
DataAccess.delete(Series.class, id);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}/add_cover")
|
@Path("{id}/add_cover")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -89,7 +89,7 @@ public class SeriesResource {
|
|||||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||||
return DataTools.uploadCover(Series.class, id, fileName, fileInputStream, fileMetaData);
|
return DataTools.uploadCover(Series.class, id, fileName, fileInputStream, fileMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}/rm_cover/{coverId}")
|
@Path("{id}/rm_cover/{coverId}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -97,7 +97,7 @@ public class SeriesResource {
|
|||||||
AddOnManyToMany.removeLink(Series.class, id, "cover", coverId);
|
AddOnManyToMany.removeLink(Series.class, id, "cover", coverId);
|
||||||
return Response.ok(DataAccess.get(Series.class, id)).build();
|
return Response.ok(DataAccess.get(Series.class, id)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Series getOrCreate(final String name, final Long typeId) {
|
public static Series getOrCreate(final String name, final Long typeId) {
|
||||||
try {
|
try {
|
||||||
Series out = DataAccess.getWhere(Series.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId))));
|
Series out = DataAccess.getWhere(Series.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId))));
|
||||||
@ -114,5 +114,5 @@ public class SeriesResource {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -30,20 +30,20 @@ import jakarta.ws.rs.core.Response;
|
|||||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
|
||||||
public class TypeResource {
|
public class TypeResource {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(TypeResource.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(TypeResource.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public static Type getWithId(@PathParam("id") final Long id) throws Exception {
|
public static Type getWithId(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Type.class, id);
|
return DataAccess.get(Type.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public List<Type> get() throws Exception {
|
public List<Type> get() throws Exception {
|
||||||
return DataAccess.gets(Type.class);
|
return DataAccess.gets(Type.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@ -51,23 +51,23 @@ public class TypeResource {
|
|||||||
public Type get(@PathParam("id") final Long id) throws Exception {
|
public Type get(@PathParam("id") final Long id) throws Exception {
|
||||||
return DataAccess.get(Type.class, id);
|
return DataAccess.get(Type.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type getId(final Long id) throws Exception {
|
public static Type getId(final Long id) throws Exception {
|
||||||
return DataAccess.get(Type.class, id);
|
return DataAccess.get(Type.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* ADMIN SECTION:
|
* ADMIN SECTION:
|
||||||
* ============================================================================= */
|
* ============================================================================= */
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Type put(final String jsonRequest) throws Exception {
|
public Type put(final String jsonRequest) throws Exception {
|
||||||
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)
|
||||||
@ -75,7 +75,7 @@ public class TypeResource {
|
|||||||
DataAccess.updateWithJson(Type.class, id, jsonRequest);
|
DataAccess.updateWithJson(Type.class, id, jsonRequest);
|
||||||
return DataAccess.get(Type.class, id);
|
return DataAccess.get(Type.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -83,7 +83,7 @@ public class TypeResource {
|
|||||||
DataAccess.delete(Type.class, id);
|
DataAccess.delete(Type.class, id);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}/add_cover")
|
@Path("{id}/add_cover")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -92,7 +92,7 @@ public class TypeResource {
|
|||||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||||
return DataTools.uploadCover(Type.class, id, fileName, fileInputStream, fileMetaData);
|
return DataTools.uploadCover(Type.class, id, fileName, fileInputStream, fileMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}/rm_cover/{coverId}")
|
@Path("{id}/rm_cover/{coverId}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -100,7 +100,7 @@ public class TypeResource {
|
|||||||
AddOnManyToMany.removeLink(Type.class, id, "cover", coverId);
|
AddOnManyToMany.removeLink(Type.class, id, "cover", coverId);
|
||||||
return Response.ok(DataAccess.get(Type.class, id)).build();
|
return Response.ok(DataAccess.get(Type.class, id)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type getOrCreate(final String name) {
|
public static Type getOrCreate(final String name) {
|
||||||
try {
|
try {
|
||||||
Type out = DataAccess.getWhere(Type.class, new Condition(new QueryCondition("name", "=", name)));
|
Type out = DataAccess.getWhere(Type.class, new Condition(new QueryCondition("name", "=", name)));
|
||||||
@ -116,5 +116,5 @@ public class TypeResource {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -28,7 +28,7 @@ import jakarta.ws.rs.core.SecurityContext;
|
|||||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
|
||||||
public class UserMediaAdvancementResource {
|
public class UserMediaAdvancementResource {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(UserMediaAdvancementResource.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(UserMediaAdvancementResource.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@ -36,23 +36,23 @@ public class UserMediaAdvancementResource {
|
|||||||
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
return DataAccess.getWhere(UserMediaAdvancement.class, new Condition(new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id))));
|
return DataAccess.getWhere(UserMediaAdvancement.class, new Condition(new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public List<UserMediaAdvancement> gets(@Context final SecurityContext sc) throws Exception {
|
public List<UserMediaAdvancement> gets(@Context final SecurityContext sc) throws Exception {
|
||||||
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
return DataAccess.getsWhere(UserMediaAdvancement.class, new Condition(new QueryCondition("userId", "=", gc.userByToken.id)));
|
return DataAccess.getsWhere(UserMediaAdvancement.class, new Condition(new QueryCondition("userId", "=", gc.userByToken.id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* Modification SECTION:
|
* Modification SECTION:
|
||||||
* ============================================================================= */
|
* ============================================================================= */
|
||||||
|
|
||||||
public record MediaInformations(
|
public record MediaInformations(
|
||||||
int time,
|
int time,
|
||||||
float percent,
|
float percent,
|
||||||
int count) {};
|
int count) {}
|
||||||
|
|
||||||
//@POST
|
//@POST
|
||||||
//@Path("{id}")
|
//@Path("{id}")
|
||||||
//@RolesAllowed("USER")
|
//@RolesAllowed("USER")
|
||||||
@ -67,13 +67,13 @@ public class UserMediaAdvancementResource {
|
|||||||
elem.count = data.count;
|
elem.count = data.count;
|
||||||
return DataAccess.insert(elem);
|
return DataAccess.insert(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,11 +94,9 @@ 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
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@ -107,5 +105,5 @@ public class UserMediaAdvancementResource {
|
|||||||
DataAccess.delete(UserMediaAdvancement.class, elem.id);
|
DataAccess.delete(UserMediaAdvancement.class, elem.id);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -37,21 +37,21 @@ import jakarta.ws.rs.core.Response;
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public class VideoResource {
|
public class VideoResource {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(VideoResource.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(VideoResource.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public List<Media> get() throws Exception {
|
public List<Media> get() throws Exception {
|
||||||
return DataAccess.gets(Media.class);
|
return DataAccess.gets(Media.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
public Media get(@PathParam("id") final Long id) throws Exception {
|
public Media get(@PathParam("id") final Long id) throws Exception {
|
||||||
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)
|
||||||
@ -60,7 +60,7 @@ public class VideoResource {
|
|||||||
DataAccess.updateWithJson(Media.class, id, jsonRequest);
|
DataAccess.updateWithJson(Media.class, id, jsonRequest);
|
||||||
return DataAccess.get(Media.class, id);
|
return DataAccess.get(Media.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String multipartCorrection(final String data) {
|
private String multipartCorrection(final String data) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -73,7 +73,7 @@ public class VideoResource {
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/upload/")
|
@Path("/upload/")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -91,7 +91,7 @@ public class VideoResource {
|
|||||||
episode = multipartCorrection(episode);
|
episode = multipartCorrection(episode);
|
||||||
title = multipartCorrection(title);
|
title = multipartCorrection(title);
|
||||||
typeId = multipartCorrection(typeId);
|
typeId = multipartCorrection(typeId);
|
||||||
|
|
||||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||||
System.out.println("Upload media file: " + fileMetaData);
|
System.out.println("Upload media file: " + fileMetaData);
|
||||||
System.out.println(" - fileName: " + fileName);
|
System.out.println(" - fileName: " + fileName);
|
||||||
@ -107,7 +107,7 @@ public class VideoResource {
|
|||||||
if (typeId == null) {
|
if (typeId == null) {
|
||||||
throw new InputException("typeId", "TypiId is not specified");
|
throw new InputException("typeId", "TypiId is not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
final long tmpUID = DataResource.getTmpDataId();
|
final long tmpUID = DataResource.getTmpDataId();
|
||||||
final String sha512 = DataResource.saveTemporaryFile(fileInputStream, tmpUID);
|
final String sha512 = DataResource.saveTemporaryFile(fileInputStream, tmpUID);
|
||||||
Data data = DataResource.getWithSha512(sha512);
|
Data data = DataResource.getWithSha512(sha512);
|
||||||
@ -145,7 +145,7 @@ public class VideoResource {
|
|||||||
if (series != null) {
|
if (series != null) {
|
||||||
seriesNode = SeriesResource.getOrCreate(series, typeNode.id);
|
seriesNode = SeriesResource.getOrCreate(series, typeNode.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(" ==> " + seriesNode);
|
System.out.println(" ==> " + seriesNode);
|
||||||
System.out.println("Find seasonNode");
|
System.out.println("Find seasonNode");
|
||||||
// get uid of season:
|
// get uid of season:
|
||||||
@ -157,10 +157,10 @@ public class VideoResource {
|
|||||||
if (season != null) {
|
if (season != null) {
|
||||||
seasonNode = SeasonResource.getOrCreate(season, seriesNode.id);
|
seasonNode = SeasonResource.getOrCreate(season, seriesNode.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(" ==> " + seasonNode);
|
System.out.println(" ==> " + seasonNode);
|
||||||
System.out.println("add media");
|
System.out.println("add media");
|
||||||
|
|
||||||
final long uniqueSQLID = -1;
|
final long uniqueSQLID = -1;
|
||||||
try {
|
try {
|
||||||
final Media media = new Media();
|
final Media media = new Media();
|
||||||
@ -195,7 +195,7 @@ public class VideoResource {
|
|||||||
throw new FailException("Catch Exception ==> check server logs");
|
throw new FailException("Catch Exception ==> check server logs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}/add_cover")
|
@Path("{id}/add_cover")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -204,7 +204,7 @@ public class VideoResource {
|
|||||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||||
return DataTools.uploadCover(Media.class, id, fileName, fileInputStream, fileMetaData);
|
return DataTools.uploadCover(Media.class, id, fileName, fileInputStream, fileMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}/rm_cover/{coverId}")
|
@Path("{id}/rm_cover/{coverId}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@ -212,7 +212,7 @@ public class VideoResource {
|
|||||||
AddOnManyToMany.removeLink(Media.class, id, "cover", coverId);
|
AddOnManyToMany.removeLink(Media.class, id, "cover", coverId);
|
||||||
return Response.ok(DataAccess.get(Media.class, id)).build();
|
return Response.ok(DataAccess.get(Media.class, id)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
|
@ -5,18 +5,18 @@ import java.util.List;
|
|||||||
import org.kar.archidata.migration.MigrationSqlStep;
|
import org.kar.archidata.migration.MigrationSqlStep;
|
||||||
|
|
||||||
public class Migration20231015 extends MigrationSqlStep {
|
public class Migration20231015 extends MigrationSqlStep {
|
||||||
|
|
||||||
public static final int KARSO_INITIALISATION_ID = 1;
|
public static final int KARSO_INITIALISATION_ID = 1;
|
||||||
|
|
||||||
@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() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateStep() throws Exception {
|
public void generateStep() throws Exception {
|
||||||
for (String elem : List.of("data", "media", "media_link_cover", "season", "season_link_cover", "series", "series_link_cover", "type", "type_link_cover", "user", "userMediaAdvancement")) {
|
for (String elem : List.of("data", "media", "media_link_cover", "season", "season_link_cover", "series", "series_link_cover", "type", "type_link_cover", "user", "userMediaAdvancement")) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { SeasonService , ArianeService, DataService} from 'app/service';
|
import { SeasonService, ArianeService, DataService } from 'app/service';
|
||||||
import { NodeData } from 'common/model';
|
import { NodeData } from 'common/model';
|
||||||
|
|
||||||
import { UploadProgress } from 'common/popin/upload-progress/upload-progress';
|
import { UploadProgress } from 'common/popin/upload-progress/upload-progress';
|
||||||
@ -21,16 +21,16 @@ export interface ElementList {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-season-edit',
|
selector: 'app-season-edit',
|
||||||
templateUrl: './season-edit.html',
|
templateUrl: './season-edit.html',
|
||||||
styleUrls: [ './season-edit.less' ]
|
styleUrls: ['./season-edit.less']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SeasonEditScene implements OnInit {
|
export class SeasonEditScene implements OnInit {
|
||||||
idSeason:number = -1;
|
idSeason: number = -1;
|
||||||
itemIsRemoved:boolean = false;
|
itemIsRemoved: boolean = false;
|
||||||
itemIsNotFound:boolean = false;
|
itemIsNotFound: boolean = false;
|
||||||
itemIsLoading:boolean = true;
|
itemIsLoading: boolean = true;
|
||||||
|
|
||||||
error:string = '';
|
error: string = '';
|
||||||
|
|
||||||
numberVal: number = null;
|
numberVal: number = null;
|
||||||
description: string = '';
|
description: string = '';
|
||||||
@ -49,11 +49,11 @@ export class SeasonEditScene implements OnInit {
|
|||||||
private deleteCoverId: number = null;
|
private deleteCoverId: number = null;
|
||||||
private deleteItemId: number = null;
|
private deleteItemId: number = null;
|
||||||
deleteConfirmed() {
|
deleteConfirmed() {
|
||||||
if(this.deleteCoverId !== null) {
|
if (this.deleteCoverId !== null) {
|
||||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
if(this.deleteItemId !== null) {
|
if (this.deleteItemId !== null) {
|
||||||
this.removeItemAfterConfirm(this.deleteItemId);
|
this.removeItemAfterConfirm(this.deleteItemId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
@ -67,9 +67,9 @@ export class SeasonEditScene implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private seasonService: SeasonService,
|
private seasonService: SeasonService,
|
||||||
private arianeService: ArianeService,
|
private arianeService: ArianeService,
|
||||||
private popInService: PopInService,
|
private popInService: PopInService,
|
||||||
private dataService: DataService) {
|
private dataService: DataService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ export class SeasonEditScene implements OnInit {
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.seasonService.get(this.idSeason)
|
this.seasonService.get(this.idSeason)
|
||||||
.then((response: NodeData) => {
|
.then((response: NodeData) => {
|
||||||
console.log(`get response of season : ${ JSON.stringify(response, null, 2)}`);
|
console.log(`get response of season : ${JSON.stringify(response, null, 2)}`);
|
||||||
if (isNumberFinite(response.name)) {
|
if (isNumberFinite(response.name)) {
|
||||||
self.numberVal = response.name;
|
self.numberVal = response.name;
|
||||||
}
|
}
|
||||||
@ -95,44 +95,44 @@ export class SeasonEditScene implements OnInit {
|
|||||||
self.itemIsLoading = false;
|
self.itemIsLoading = false;
|
||||||
});
|
});
|
||||||
this.seasonService.getVideo(this.idSeason)
|
this.seasonService.getVideo(this.idSeason)
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
self.videoCount = response.length;
|
self.videoCount = response.length;
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
self.videoCount = '---';
|
self.videoCount = '---';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCoverList(covers: any) {
|
updateCoverList(covers: any) {
|
||||||
this.coversDisplay = [];
|
this.coversDisplay = [];
|
||||||
if(covers !== undefined && covers !== null) {
|
if (covers !== undefined && covers !== null) {
|
||||||
for(let iii = 0; iii < covers.length; iii++) {
|
for (let iii = 0; iii < covers.length; iii++) {
|
||||||
this.coversDisplay.push({
|
this.coversDisplay.push({
|
||||||
id:covers[iii],
|
id: covers[iii],
|
||||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
url: this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.coversDisplay = [];
|
this.coversDisplay = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onNumber(value:any):void {
|
onNumber(value: any): void {
|
||||||
this.numberVal = value;
|
this.numberVal = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescription(value:any):void {
|
onDescription(value: any): void {
|
||||||
this.description = value;
|
this.description = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendValues():void {
|
sendValues(): void {
|
||||||
console.log('send new values....');
|
console.log('send new values....');
|
||||||
let data = {
|
let data = {
|
||||||
name: this.numberVal,
|
name: this.numberVal,
|
||||||
description: this.description
|
description: this.description
|
||||||
};
|
};
|
||||||
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
|
||||||
@ -151,15 +151,15 @@ export class SeasonEditScene implements OnInit {
|
|||||||
|
|
||||||
// At the file input element
|
// At the file input element
|
||||||
// (change)="selectFile($event)"
|
// (change)="selectFile($event)"
|
||||||
onChangeCover(value:any):void {
|
onChangeCover(value: any): void {
|
||||||
this.selectedFiles = value.files;
|
this.selectedFiles = value.files;
|
||||||
this.coverFile = this.selectedFiles[0];
|
this.coverFile = this.selectedFiles[0];
|
||||||
console.log(`select file ${ this.coverFile.name}`);
|
console.log(`select file ${this.coverFile.name}`);
|
||||||
this.uploadCover(this.coverFile);
|
this.uploadCover(this.coverFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadCover(file:File) {
|
uploadCover(file: File) {
|
||||||
if(file === undefined) {
|
if (file === undefined) {
|
||||||
console.log('No file selected!');
|
console.log('No file selected!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,35 +169,35 @@ export class SeasonEditScene implements OnInit {
|
|||||||
// display the upload pop-in
|
// display the upload pop-in
|
||||||
this.popInService.open('popin-upload-progress');
|
this.popInService.open('popin-upload-progress');
|
||||||
this.seasonService.uploadCover(file, this.idSeason, (count, total) => {
|
this.seasonService.uploadCover(file, this.idSeason, (count, total) => {
|
||||||
self.upload.mediaSendSize = count;
|
self.upload.mediaSendSize = count;
|
||||||
self.upload.mediaSize = total;
|
self.upload.mediaSize = total;
|
||||||
})
|
})
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
self.upload.result = 'Cover added done';
|
self.upload.result = 'Cover added done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not add the cover in the video...');
|
console.log('Can not add the cover in the video...');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCover(id:number) {
|
removeCover(id: number) {
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
this.confirmDeleteComment = `Delete the cover ID: ${id}`;
|
||||||
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
||||||
this.deleteCoverId = id;
|
this.deleteCoverId = id;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeCoverAfterConfirm(id:number) {
|
removeCoverAfterConfirm(id: number) {
|
||||||
console.log(`Request remove cover: ${ id}`);
|
console.log(`Request remove cover: ${id}`);
|
||||||
let self = this;
|
let self = this;
|
||||||
this.seasonService.deleteCover(this.idSeason, id)
|
this.seasonService.deleteCover(this.idSeason, id)
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
self.upload.result = 'Cover remove done';
|
self.upload.result = 'Cover remove done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not remove the cover of the video...');
|
console.log('Can not remove the cover of the video...');
|
||||||
});
|
});
|
||||||
@ -206,11 +206,11 @@ export class SeasonEditScene implements OnInit {
|
|||||||
removeItem() {
|
removeItem() {
|
||||||
console.log('Request remove Media...');
|
console.log('Request remove Media...');
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the Season: ${ this.idSeason}`;
|
this.confirmDeleteComment = `Delete the Season: ${this.idSeason}`;
|
||||||
this.deleteItemId = this.idSeason;
|
this.deleteItemId = this.idSeason;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeItemAfterConfirm(id:number) {
|
removeItemAfterConfirm(id: number) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.seasonService.delete(id)
|
this.seasonService.delete(id)
|
||||||
.then((response3) => {
|
.then((response3) => {
|
||||||
|
@ -20,30 +20,30 @@ export class ElementList {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-series-edit',
|
selector: 'app-series-edit',
|
||||||
templateUrl: './series-edit.html',
|
templateUrl: './series-edit.html',
|
||||||
styleUrls: [ './series-edit.less' ]
|
styleUrls: ['./series-edit.less']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SeriesEditScene implements OnInit {
|
export class SeriesEditScene implements OnInit {
|
||||||
idSeries:number = -1;
|
idSeries: number = -1;
|
||||||
itemIsRemoved:boolean = false;
|
itemIsRemoved: boolean = false;
|
||||||
itemIsNotFound:boolean = false;
|
itemIsNotFound: boolean = false;
|
||||||
itemIsLoading:boolean = true;
|
itemIsLoading: boolean = true;
|
||||||
|
|
||||||
error:string = '';
|
error: string = '';
|
||||||
|
|
||||||
typeId:number = null;
|
typeId: number = null;
|
||||||
name:string = '';
|
name: string = '';
|
||||||
description:string = '';
|
description: string = '';
|
||||||
coverFile:File;
|
coverFile: File;
|
||||||
uploadFileValue:string = '';
|
uploadFileValue: string = '';
|
||||||
selectedFiles:FileList;
|
selectedFiles: FileList;
|
||||||
|
|
||||||
seasonsCount: string = null;
|
seasonsCount: string = null;
|
||||||
videoCount: string = null;
|
videoCount: string = null;
|
||||||
|
|
||||||
coversDisplay:Array<any> = [];
|
coversDisplay: Array<any> = [];
|
||||||
// section tha define the upload value to display in the pop-in of upload
|
// section tha define the upload value to display in the pop-in of upload
|
||||||
public upload:UploadProgress = new UploadProgress();
|
public upload: UploadProgress = new UploadProgress();
|
||||||
|
|
||||||
|
|
||||||
listType: ElementList[] = [
|
listType: ElementList[] = [
|
||||||
@ -51,16 +51,16 @@ export class SeriesEditScene implements OnInit {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// --------------- confirm section ------------------
|
// --------------- confirm section ------------------
|
||||||
public confirmDeleteComment:string = null;
|
public confirmDeleteComment: string = null;
|
||||||
public confirmDeleteImageUrl:string = null;
|
public confirmDeleteImageUrl: string = null;
|
||||||
private deleteCoverId:number = null;
|
private deleteCoverId: number = null;
|
||||||
private deleteItemId:number = null;
|
private deleteItemId: number = null;
|
||||||
deleteConfirmed() {
|
deleteConfirmed() {
|
||||||
if(this.deleteCoverId !== null) {
|
if (this.deleteCoverId !== null) {
|
||||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
if(this.deleteItemId !== null) {
|
if (this.deleteItemId !== null) {
|
||||||
this.removeItemAfterConfirm(this.deleteItemId);
|
this.removeItemAfterConfirm(this.deleteItemId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
@ -74,25 +74,25 @@ export class SeriesEditScene implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
constructor(private dataService: DataService,
|
constructor(private dataService: DataService,
|
||||||
private typeService: TypeService,
|
private typeService: TypeService,
|
||||||
private seriesService: SeriesService,
|
private seriesService: SeriesService,
|
||||||
private arianeService: ArianeService,
|
private arianeService: ArianeService,
|
||||||
private popInService: PopInService) {
|
private popInService: PopInService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.idSeries = this.arianeService.getSeriesId();
|
this.idSeries = this.arianeService.getSeriesId();
|
||||||
let self = this;
|
let self = this;
|
||||||
this.listType = [ { value: null, label: '---' } ];
|
this.listType = [{ value: null, label: '---' }];
|
||||||
|
|
||||||
this.typeService.getData()
|
this.typeService.getData()
|
||||||
.then((response2) => {
|
.then((response2) => {
|
||||||
for(let iii = 0; iii < response2.length; iii++) {
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
||||||
}
|
}
|
||||||
}).catch((response2) => {
|
}).catch((response2) => {
|
||||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.seriesService.get(this.idSeries)
|
this.seriesService.get(this.idSeries)
|
||||||
@ -112,7 +112,7 @@ export class SeriesEditScene implements OnInit {
|
|||||||
self.itemIsNotFound = true;
|
self.itemIsNotFound = true;
|
||||||
self.itemIsLoading = false;
|
self.itemIsLoading = false;
|
||||||
});
|
});
|
||||||
console.log(`get parameter id: ${ this.idSeries}`);
|
console.log(`get parameter id: ${this.idSeries}`);
|
||||||
this.seriesService.getSeason(this.idSeries)
|
this.seriesService.getSeason(this.idSeries)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
self.seasonsCount = "" + response.length;
|
self.seasonsCount = "" + response.length;
|
||||||
@ -129,11 +129,11 @@ export class SeriesEditScene implements OnInit {
|
|||||||
|
|
||||||
updateCoverList(covers: any) {
|
updateCoverList(covers: any) {
|
||||||
this.coversDisplay = [];
|
this.coversDisplay = [];
|
||||||
if(covers !== undefined && covers !== null) {
|
if (covers !== undefined && covers !== null) {
|
||||||
for(let iii = 0; iii < covers.length; iii++) {
|
for (let iii = 0; iii < covers.length; iii++) {
|
||||||
this.coversDisplay.push({
|
this.coversDisplay.push({
|
||||||
id:covers[iii],
|
id: covers[iii],
|
||||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
url: this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -141,33 +141,33 @@ export class SeriesEditScene implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onName(value:any):void {
|
onName(value: any): void {
|
||||||
this.name = value;
|
this.name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescription(value:any):void {
|
onDescription(value: any): void {
|
||||||
this.description = value;
|
this.description = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeType(value:any):void {
|
onChangeType(value: any): void {
|
||||||
console.log(`Change requested of type ... ${ value}`);
|
console.log(`Change requested of type ... ${value}`);
|
||||||
this.typeId = value;
|
this.typeId = value;
|
||||||
if(this.typeId === undefined) {
|
if (this.typeId === undefined) {
|
||||||
this.typeId = null;
|
this.typeId = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendValues():void {
|
sendValues(): void {
|
||||||
console.log('send new values....');
|
console.log('send new values....');
|
||||||
let data = {
|
let data = {
|
||||||
parentId: this.typeId,
|
parentId: this.typeId,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
description: this.description
|
description: this.description
|
||||||
};
|
};
|
||||||
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
|
||||||
@ -186,15 +186,15 @@ export class SeriesEditScene implements OnInit {
|
|||||||
|
|
||||||
// At the file input element
|
// At the file input element
|
||||||
// (change)="selectFile($event)"
|
// (change)="selectFile($event)"
|
||||||
onChangeCover(value:any):void {
|
onChangeCover(value: any): void {
|
||||||
this.selectedFiles = value.files;
|
this.selectedFiles = value.files;
|
||||||
this.coverFile = this.selectedFiles[0];
|
this.coverFile = this.selectedFiles[0];
|
||||||
console.log(`select file ${ this.coverFile.name}`);
|
console.log(`select file ${this.coverFile.name}`);
|
||||||
this.uploadCover(this.coverFile);
|
this.uploadCover(this.coverFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadCover(file:File) {
|
uploadCover(file: File) {
|
||||||
if(file === undefined) {
|
if (file === undefined) {
|
||||||
console.log('No file selected!');
|
console.log('No file selected!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -204,34 +204,34 @@ export class SeriesEditScene implements OnInit {
|
|||||||
// display the upload pop-in
|
// display the upload pop-in
|
||||||
this.popInService.open('popin-upload-progress');
|
this.popInService.open('popin-upload-progress');
|
||||||
this.seriesService.uploadCover(file, this.idSeries, (count, total) => {
|
this.seriesService.uploadCover(file, this.idSeries, (count, total) => {
|
||||||
self.upload.mediaSendSize = count;
|
self.upload.mediaSendSize = count;
|
||||||
self.upload.mediaSize = total;
|
self.upload.mediaSize = total;
|
||||||
})
|
})
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
self.upload.result = 'Cover added done';
|
self.upload.result = 'Cover added done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not add the cover in the video...');
|
console.log('Can not add the cover in the video...');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
removeCover(id:number) {
|
removeCover(id: number) {
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
this.confirmDeleteComment = `Delete the cover ID: ${id}`;
|
||||||
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
||||||
this.deleteCoverId = id;
|
this.deleteCoverId = id;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeCoverAfterConfirm(id:number) {
|
removeCoverAfterConfirm(id: number) {
|
||||||
console.log(`Request remove cover: ${ id}`);
|
console.log(`Request remove cover: ${id}`);
|
||||||
let self = this;
|
let self = this;
|
||||||
this.seriesService.deleteCover(this.idSeries, id)
|
this.seriesService.deleteCover(this.idSeries, id)
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
self.upload.result = 'Cover remove done';
|
self.upload.result = 'Cover remove done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not remove the cover of the video...');
|
console.log('Can not remove the cover of the video...');
|
||||||
});
|
});
|
||||||
@ -239,11 +239,11 @@ export class SeriesEditScene implements OnInit {
|
|||||||
removeItem() {
|
removeItem() {
|
||||||
console.log('Request remove Media...');
|
console.log('Request remove Media...');
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the Series: ${ this.idSeries}`;
|
this.confirmDeleteComment = `Delete the Series: ${this.idSeries}`;
|
||||||
this.deleteItemId = this.idSeries;
|
this.deleteItemId = this.idSeries;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeItemAfterConfirm(_id:number) {
|
removeItemAfterConfirm(_id: number) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.seriesService.delete(_id)
|
this.seriesService.delete(_id)
|
||||||
.then((response3) => {
|
.then((response3) => {
|
||||||
|
@ -21,16 +21,16 @@ export interface ElementList {
|
|||||||
|
|
||||||
|
|
||||||
class DataToSend {
|
class DataToSend {
|
||||||
name:string = '';
|
name: string = '';
|
||||||
description:string = '';
|
description: string = '';
|
||||||
episode?:number;
|
episode?: number;
|
||||||
seriesId:number = null;
|
seriesId: number = null;
|
||||||
seasonId:number = null;
|
seasonId: number = null;
|
||||||
dataId:number = -1;
|
dataId: number = -1;
|
||||||
time?:number;
|
time?: number;
|
||||||
typeId:number = null;
|
typeId: number = null;
|
||||||
covers:number[] = [];
|
covers: number[] = [];
|
||||||
generatedName:string = '';
|
generatedName: string = '';
|
||||||
clone() {
|
clone() {
|
||||||
let tmp = new DataToSend();
|
let tmp = new DataToSend();
|
||||||
tmp.name = this.name;
|
tmp.name = this.name;
|
||||||
@ -50,38 +50,38 @@ class DataToSend {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-video-edit',
|
selector: 'app-video-edit',
|
||||||
templateUrl: './video-edit.html',
|
templateUrl: './video-edit.html',
|
||||||
styleUrls: [ './video-edit.less' ]
|
styleUrls: ['./video-edit.less']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class VideoEditScene implements OnInit {
|
export class VideoEditScene implements OnInit {
|
||||||
idVideo:number = -1;
|
idVideo: number = -1;
|
||||||
itemIsRemoved:boolean = false;
|
itemIsRemoved: boolean = false;
|
||||||
itemIsNotFound:boolean = false;
|
itemIsNotFound: boolean = false;
|
||||||
itemIsLoading:boolean = true;
|
itemIsLoading: boolean = true;
|
||||||
|
|
||||||
error:string = '';
|
error: string = '';
|
||||||
|
|
||||||
data:DataToSend = new DataToSend();
|
data: DataToSend = new DataToSend();
|
||||||
dataOri:DataToSend = new DataToSend();
|
dataOri: DataToSend = new DataToSend();
|
||||||
coverFile:File;
|
coverFile: File;
|
||||||
uploadFileValue:string = '';
|
uploadFileValue: string = '';
|
||||||
selectedFiles:FileList;
|
selectedFiles: FileList;
|
||||||
needSend:boolean = false;
|
needSend: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
// section tha define the upload value to display in the pop-in of upload
|
// section tha define the upload value to display in the pop-in of upload
|
||||||
upload:UploadProgress = new UploadProgress();
|
upload: UploadProgress = new UploadProgress();
|
||||||
// --------------- confirm section ------------------
|
// --------------- confirm section ------------------
|
||||||
public confirmDeleteComment:string = null;
|
public confirmDeleteComment: string = null;
|
||||||
public confirmDeleteImageUrl:string = null;
|
public confirmDeleteImageUrl: string = null;
|
||||||
private deleteCoverId:number = null;
|
private deleteCoverId: number = null;
|
||||||
private deleteMediaId:number = null;
|
private deleteMediaId: number = null;
|
||||||
deleteConfirmed() {
|
deleteConfirmed() {
|
||||||
if(this.deleteCoverId !== null) {
|
if (this.deleteCoverId !== null) {
|
||||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
if(this.deleteMediaId !== null) {
|
if (this.deleteMediaId !== null) {
|
||||||
this.removeItemAfterConfirm(this.deleteMediaId);
|
this.removeItemAfterConfirm(this.deleteMediaId);
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ export class VideoEditScene implements OnInit {
|
|||||||
this.deleteMediaId = null;
|
this.deleteMediaId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
coversDisplay:Array<any> = [];
|
coversDisplay: Array<any> = [];
|
||||||
|
|
||||||
listType: ElementList[] = [
|
listType: ElementList[] = [
|
||||||
{ value: undefined, label: '---' },
|
{ value: undefined, label: '---' },
|
||||||
@ -109,36 +109,36 @@ export class VideoEditScene implements OnInit {
|
|||||||
{ value: undefined, label: '---' },
|
{ value: undefined, label: '---' },
|
||||||
];
|
];
|
||||||
constructor(
|
constructor(
|
||||||
private typeService: TypeService,
|
private typeService: TypeService,
|
||||||
private seriesService: SeriesService,
|
private seriesService: SeriesService,
|
||||||
private videoService: VideoService,
|
private videoService: VideoService,
|
||||||
private arianeService: ArianeService,
|
private arianeService: ArianeService,
|
||||||
private popInService: PopInService,
|
private popInService: PopInService,
|
||||||
private dataService: DataService) {
|
private dataService: DataService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNeedSend(): boolean {
|
updateNeedSend(): boolean {
|
||||||
this.needSend = false;
|
this.needSend = false;
|
||||||
if(this.data.name !== this.dataOri.name) {
|
if (this.data.name !== this.dataOri.name) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.description !== this.dataOri.description) {
|
if (this.data.description !== this.dataOri.description) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.episode !== this.dataOri.episode) {
|
if (this.data.episode !== this.dataOri.episode) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.time !== this.dataOri.time) {
|
if (this.data.time !== this.dataOri.time) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.typeId !== this.dataOri.typeId) {
|
if (this.data.typeId !== this.dataOri.typeId) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.seriesId !== this.dataOri.seriesId) {
|
if (this.data.seriesId !== this.dataOri.seriesId) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
if(this.data.seasonId !== this.dataOri.seasonId) {
|
if (this.data.seasonId !== this.dataOri.seasonId) {
|
||||||
this.needSend = true;
|
this.needSend = true;
|
||||||
}
|
}
|
||||||
return this.needSend;
|
return this.needSend;
|
||||||
@ -147,12 +147,12 @@ export class VideoEditScene implements OnInit {
|
|||||||
updateCoverList(covers: any) {
|
updateCoverList(covers: any) {
|
||||||
this.coversDisplay = [];
|
this.coversDisplay = [];
|
||||||
this.data.covers = [];
|
this.data.covers = [];
|
||||||
if(covers !== undefined && covers !== null) {
|
if (covers !== undefined && covers !== null) {
|
||||||
for(let iii = 0; iii < covers.length; iii++) {
|
for (let iii = 0; iii < covers.length; iii++) {
|
||||||
this.data.covers.push(covers[iii]);
|
this.data.covers.push(covers[iii]);
|
||||||
this.coversDisplay.push({
|
this.coversDisplay.push({
|
||||||
id:covers[iii],
|
id: covers[iii],
|
||||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
url: this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -162,31 +162,31 @@ export class VideoEditScene implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.idVideo = this.arianeService.getVideoId();
|
this.idVideo = this.arianeService.getVideoId();
|
||||||
let self = this;
|
let self = this;
|
||||||
this.listType = [ { value: null, label: '---' } ];
|
this.listType = [{ value: null, label: '---' }];
|
||||||
this.listUniverse = [ { value: null, label: '---' } ];
|
this.listUniverse = [{ value: null, label: '---' }];
|
||||||
this.listSeries = [ { value: null, label: '---' } ];
|
this.listSeries = [{ value: null, label: '---' }];
|
||||||
this.listSeason = [ { value: null, label: '---' } ];
|
this.listSeason = [{ value: null, label: '---' }];
|
||||||
this.typeService.getData()
|
this.typeService.getData()
|
||||||
.then((response2) => {
|
.then((response2) => {
|
||||||
for(let iii = 0; iii < response2.length; iii++) {
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
||||||
}
|
}
|
||||||
}).catch((response2) => {
|
}).catch((response2) => {
|
||||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`);
|
||||||
});
|
});
|
||||||
// this.seriesService.getOrder()
|
// this.seriesService.getOrder()
|
||||||
this.seriesService.getData()
|
this.seriesService.getData()
|
||||||
.then((response3) => {
|
.then((response3) => {
|
||||||
for(let iii = 0; iii < response3.length; iii++) {
|
for (let iii = 0; iii < response3.length; iii++) {
|
||||||
self.listSeries.push({ value: response3[iii].id, label: response3[iii].name });
|
self.listSeries.push({ value: response3[iii].id, label: response3[iii].name });
|
||||||
console.log(`[${ self.data.dataId }] Get series: ${ response3[iii].id }, label:${ response3[iii].name}`);
|
console.log(`[${self.data.dataId}] Get series: ${response3[iii].id}, label:${response3[iii].name}`);
|
||||||
}
|
}
|
||||||
}).catch((response3) => {
|
}).catch((response3) => {
|
||||||
console.log(`get response3 : ${ JSON.stringify(response3, null, 2)}`);
|
console.log(`get response3 : ${JSON.stringify(response3, null, 2)}`);
|
||||||
});
|
});
|
||||||
this.videoService.get(this.idVideo)
|
this.videoService.get(this.idVideo)
|
||||||
.then((response: Media) => {
|
.then((response: Media) => {
|
||||||
console.log(`get response of video : ${ JSON.stringify(response, null, 2)}`);
|
console.log(`get response of video : ${JSON.stringify(response, null, 2)}`);
|
||||||
self.data.name = response.name;
|
self.data.name = response.name;
|
||||||
self.data.description = response.description;
|
self.data.description = response.description;
|
||||||
self.data.episode = response.episode;
|
self.data.episode = response.episode;
|
||||||
@ -196,13 +196,13 @@ export class VideoEditScene implements OnInit {
|
|||||||
self.onChangeType(response.typeId);
|
self.onChangeType(response.typeId);
|
||||||
self.onChangeSeries(response.seriesId);
|
self.onChangeSeries(response.seriesId);
|
||||||
self.data.seasonId = response.seasonId;
|
self.data.seasonId = response.seasonId;
|
||||||
if(self.data.seasonId === undefined) {
|
if (self.data.seasonId === undefined) {
|
||||||
self.data.seasonId = null;
|
self.data.seasonId = null;
|
||||||
}
|
}
|
||||||
self.dataOri = self.data.clone();
|
self.dataOri = self.data.clone();
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
self.updateNeedSend();
|
self.updateNeedSend();
|
||||||
console.log(`coversList : ${ JSON.stringify(self.coversDisplay, null, 2)}`);
|
console.log(`coversList : ${JSON.stringify(self.coversDisplay, null, 2)}`);
|
||||||
self.itemIsLoading = false;
|
self.itemIsLoading = false;
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
self.error = 'Can not get the data';
|
self.error = 'Can not get the data';
|
||||||
@ -215,82 +215,82 @@ export class VideoEditScene implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeType(value:any):void {
|
onChangeType(value: any): void {
|
||||||
console.log(`Change requested of type ... ${value}`);
|
console.log(`Change requested of type ... ${value}`);
|
||||||
this.data.typeId = value;
|
this.data.typeId = value;
|
||||||
if(this.data.typeId === undefined) {
|
if (this.data.typeId === undefined) {
|
||||||
this.data.typeId = null;
|
this.data.typeId = null;
|
||||||
}
|
}
|
||||||
this.data.seriesId = null;
|
this.data.seriesId = null;
|
||||||
this.data.seasonId = null;
|
this.data.seasonId = null;
|
||||||
this.listSeries = [ { value: undefined, label: '---' } ];
|
this.listSeries = [{ value: undefined, label: '---' }];
|
||||||
this.listSeason = [ { value: undefined, label: '---' } ];
|
this.listSeason = [{ value: undefined, label: '---' }];
|
||||||
let self = this;
|
let self = this;
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
if(this.data.typeId !== undefined) {
|
if (this.data.typeId !== undefined) {
|
||||||
self.typeService.getSubSeries(this.data.typeId)
|
self.typeService.getSubSeries(this.data.typeId)
|
||||||
.then((response2: NodeData[]) => {
|
.then((response2: NodeData[]) => {
|
||||||
for(let iii = 0; iii < response2.length; iii++) {
|
for (let iii = 0; iii < response2.length; iii++) {
|
||||||
self.listSeries.push({ value: response2[iii].id, label: response2[iii].name });
|
self.listSeries.push({ value: response2[iii].id, label: response2[iii].name });
|
||||||
}
|
}
|
||||||
}).catch((response2) => {
|
}).catch((response2) => {
|
||||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeSeries(value:any):void {
|
onChangeSeries(value: any): void {
|
||||||
this.data.seriesId = value;
|
this.data.seriesId = value;
|
||||||
if(this.data.seriesId === undefined) {
|
if (this.data.seriesId === undefined) {
|
||||||
this.data.seriesId = null;
|
this.data.seriesId = null;
|
||||||
}
|
}
|
||||||
this.data.seasonId = null;
|
this.data.seasonId = null;
|
||||||
this.listSeason = [ { value: undefined, label: '---' } ];
|
this.listSeason = [{ value: undefined, label: '---' }];
|
||||||
let self = this;
|
let self = this;
|
||||||
if(this.data.seriesId !== undefined) {
|
if (this.data.seriesId !== undefined) {
|
||||||
self.seriesService.getSeason(this.data.seriesId)
|
self.seriesService.getSeason(this.data.seriesId)
|
||||||
.then((response3: NodeData[]) => {
|
.then((response3: NodeData[]) => {
|
||||||
for(let iii = 0; iii < response3.length; iii++) {
|
for (let iii = 0; iii < response3.length; iii++) {
|
||||||
self.listSeason.push({ value: response3[iii].id, label: `season ${ response3[iii].name}` });
|
self.listSeason.push({ value: response3[iii].id, label: `season ${response3[iii].name}` });
|
||||||
}
|
}
|
||||||
}).catch((response3) => {
|
}).catch((response3) => {
|
||||||
console.log(`get response22 : ${ JSON.stringify(response3, null, 2)}`);
|
console.log(`get response22 : ${JSON.stringify(response3, null, 2)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
onChangeSeason(value:any):void {
|
onChangeSeason(value: any): void {
|
||||||
this.data.seasonId = value;
|
this.data.seasonId = value;
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
onName(value:any):void {
|
onName(value: any): void {
|
||||||
this.data.name = value;
|
this.data.name = value;
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescription(value:any):void {
|
onDescription(value: any): void {
|
||||||
if(value.length === 0) {
|
if (value.length === 0) {
|
||||||
this.data.description = null;
|
this.data.description = null;
|
||||||
} else {
|
} else {
|
||||||
this.data.description = value;
|
this.data.description = value;
|
||||||
}
|
}
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
onDate(value:any):void {
|
onDate(value: any): void {
|
||||||
if(value.value.length > 4) {
|
if (value.value.length > 4) {
|
||||||
value.value = this.data.time;
|
value.value = this.data.time;
|
||||||
} else {
|
} else {
|
||||||
this.data.time = value.value;
|
this.data.time = value.value;
|
||||||
}
|
}
|
||||||
if(this.data.time < 10) {
|
if (this.data.time < 10) {
|
||||||
this.data.time = null;
|
this.data.time = null;
|
||||||
}
|
}
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
onEpisode(value:any):void {
|
onEpisode(value: any): void {
|
||||||
if(value.value.length > 4) {
|
if (value.value.length > 4) {
|
||||||
value.value = this.data.episode;
|
value.value = this.data.episode;
|
||||||
} else {
|
} else {
|
||||||
this.data.episode = parseInt(value.value, 10);
|
this.data.episode = parseInt(value.value, 10);
|
||||||
@ -298,41 +298,41 @@ export class VideoEditScene implements OnInit {
|
|||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendValues():void {
|
sendValues(): void {
|
||||||
console.log('send new values....');
|
console.log('send new values....');
|
||||||
let data:any = {};
|
let data: any = {};
|
||||||
if(this.data.name !== this.dataOri.name) {
|
if (this.data.name !== this.dataOri.name) {
|
||||||
data.name = this.data.name;
|
data.name = this.data.name;
|
||||||
}
|
}
|
||||||
if(this.data.description !== this.dataOri.description) {
|
if (this.data.description !== this.dataOri.description) {
|
||||||
if(this.data.description === undefined) {
|
if (this.data.description === undefined) {
|
||||||
data.description = null;
|
data.description = null;
|
||||||
} else {
|
} else {
|
||||||
data.description = this.data.description;
|
data.description = this.data.description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.data.episode !== this.dataOri.episode) {
|
if (this.data.episode !== this.dataOri.episode) {
|
||||||
data.episode = this.data.episode;
|
data.episode = this.data.episode;
|
||||||
}
|
}
|
||||||
if(this.data.time !== this.dataOri.time) {
|
if (this.data.time !== this.dataOri.time) {
|
||||||
data.time = this.data.time;
|
data.time = this.data.time;
|
||||||
}
|
}
|
||||||
if(this.data.typeId !== this.dataOri.typeId) {
|
if (this.data.typeId !== this.dataOri.typeId) {
|
||||||
if(this.data.typeId === undefined) {
|
if (this.data.typeId === undefined) {
|
||||||
data.typeId = null;
|
data.typeId = null;
|
||||||
} else {
|
} else {
|
||||||
data.typeId = this.data.typeId;
|
data.typeId = this.data.typeId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.data.seriesId !== this.dataOri.seriesId) {
|
if (this.data.seriesId !== this.dataOri.seriesId) {
|
||||||
if(this.data.seriesId === undefined) {
|
if (this.data.seriesId === undefined) {
|
||||||
data.seriesId = null;
|
data.seriesId = null;
|
||||||
} else {
|
} else {
|
||||||
data.seriesId = this.data.seriesId;
|
data.seriesId = this.data.seriesId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.data.seasonId !== this.dataOri.seasonId) {
|
if (this.data.seasonId !== this.dataOri.seasonId) {
|
||||||
if(this.data.seasonId === undefined) {
|
if (this.data.seasonId === undefined) {
|
||||||
data.seasonId = null;
|
data.seasonId = null;
|
||||||
} else {
|
} else {
|
||||||
data.seasonId = this.data.seasonId;
|
data.seasonId = this.data.seasonId;
|
||||||
@ -340,12 +340,12 @@ 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();
|
||||||
}).catch((response3) => {
|
}).catch((response3) => {
|
||||||
console.log(`get response22 : ${ JSON.stringify(response3, null, 2)}`);
|
console.log(`get response22 : ${JSON.stringify(response3, null, 2)}`);
|
||||||
self.updateNeedSend();
|
self.updateNeedSend();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -367,16 +367,16 @@ export class VideoEditScene implements OnInit {
|
|||||||
|
|
||||||
// At the file input element
|
// At the file input element
|
||||||
// (change)="selectFile($event)"
|
// (change)="selectFile($event)"
|
||||||
onChangeCover(value:any):void {
|
onChangeCover(value: any): void {
|
||||||
this.selectedFiles = value.files;
|
this.selectedFiles = value.files;
|
||||||
this.coverFile = this.selectedFiles[0];
|
this.coverFile = this.selectedFiles[0];
|
||||||
console.log(`select file ${ this.coverFile.name}`);
|
console.log(`select file ${this.coverFile.name}`);
|
||||||
this.uploadCover(this.coverFile);
|
this.uploadCover(this.coverFile);
|
||||||
this.updateNeedSend();
|
this.updateNeedSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadCover(file?:File) {
|
uploadCover(file?: File) {
|
||||||
if(file === undefined) {
|
if (file === undefined) {
|
||||||
console.log('No file selected!');
|
console.log('No file selected!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -386,51 +386,51 @@ export class VideoEditScene implements OnInit {
|
|||||||
// display the upload pop-in
|
// display the upload pop-in
|
||||||
this.popInService.open('popin-upload-progress');
|
this.popInService.open('popin-upload-progress');
|
||||||
this.videoService.uploadCover(file, this.idVideo, (count, total) => {
|
this.videoService.uploadCover(file, this.idVideo, (count, total) => {
|
||||||
self.upload.mediaSendSize = count;
|
self.upload.mediaSendSize = count;
|
||||||
self.upload.mediaSize = total;
|
self.upload.mediaSize = total;
|
||||||
})
|
})
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
console.log(`get response of cover : ${ JSON.stringify(response, null, 2)}`);
|
console.log(`get response of cover : ${JSON.stringify(response, null, 2)}`);
|
||||||
self.upload.result = 'Cover added done';
|
self.upload.result = 'Cover added done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not add the cover in the video...');
|
console.log('Can not add the cover in the video...');
|
||||||
self.upload.error = `Error in the upload of the cover...${ JSON.stringify(response, null, 2)}`;
|
self.upload.error = `Error in the upload of the cover...${JSON.stringify(response, null, 2)}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCover(id:number) {
|
removeCover(id: number) {
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
this.confirmDeleteComment = `Delete the cover ID: ${id}`;
|
||||||
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
||||||
this.deleteCoverId = id;
|
this.deleteCoverId = id;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeCoverAfterConfirm(id:number) {
|
removeCoverAfterConfirm(id: number) {
|
||||||
console.log(`Request remove cover: ${ id}`);
|
console.log(`Request remove cover: ${id}`);
|
||||||
let self = this;
|
let self = this;
|
||||||
this.videoService.deleteCover(this.idVideo, id)
|
this.videoService.deleteCover(this.idVideo, id)
|
||||||
.then((response:any) => {
|
.then((response: any) => {
|
||||||
console.log(`get response of remove cover : ${ JSON.stringify(response, null, 2)}`);
|
console.log(`get response of remove cover : ${JSON.stringify(response, null, 2)}`);
|
||||||
self.upload.result = 'Cover remove done';
|
self.upload.result = 'Cover remove done';
|
||||||
// we retrive the whiole media ==> update data ...
|
// we retrive the whiole media ==> update data ...
|
||||||
self.updateCoverList(response.covers);
|
self.updateCoverList(response.covers);
|
||||||
}).catch((response:any) => {
|
}).catch((response: any) => {
|
||||||
// self.error = "Can not get the data";
|
// self.error = "Can not get the data";
|
||||||
console.log('Can not remove the cover of the video...');
|
console.log('Can not remove the cover of the video...');
|
||||||
self.upload.error = `Error in the upload of the cover...${ JSON.stringify(response, null, 2)}`;
|
self.upload.error = `Error in the upload of the cover...${JSON.stringify(response, null, 2)}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
removeItem() {
|
removeItem() {
|
||||||
console.log('Request remove Media...');
|
console.log('Request remove Media...');
|
||||||
this.cleanConfirm();
|
this.cleanConfirm();
|
||||||
this.confirmDeleteComment = `Delete the Media: ${ this.idVideo}`;
|
this.confirmDeleteComment = `Delete the Media: ${this.idVideo}`;
|
||||||
this.deleteMediaId = this.idVideo;
|
this.deleteMediaId = this.idVideo;
|
||||||
this.popInService.open('popin-delete-confirm');
|
this.popInService.open('popin-delete-confirm');
|
||||||
}
|
}
|
||||||
removeItemAfterConfirm(id:number) {
|
removeItemAfterConfirm(id: number) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.videoService.delete(id)
|
this.videoService.delete(id)
|
||||||
.then((response3) => {
|
.then((response3) => {
|
||||||
@ -443,15 +443,15 @@ export class VideoEditScene implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventPopUpSeason(event: string): void {
|
eventPopUpSeason(event: string): void {
|
||||||
console.log(`GET event: ${ event}`);
|
console.log(`GET event: ${event}`);
|
||||||
this.popInService.close('popin-new-season');
|
this.popInService.close('popin-new-season');
|
||||||
}
|
}
|
||||||
eventPopUpSeries(event: string): void {
|
eventPopUpSeries(event: string): void {
|
||||||
console.log(`GET event: ${ event}`);
|
console.log(`GET event: ${event}`);
|
||||||
this.popInService.close('popin-new-series');
|
this.popInService.close('popin-new-series');
|
||||||
}
|
}
|
||||||
eventPopUpType(event: string): void {
|
eventPopUpType(event: string): void {
|
||||||
console.log(`GET event: ${ event}`);
|
console.log(`GET event: ${event}`);
|
||||||
this.popInService.close('popin-new-type');
|
this.popInService.close('popin-new-type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { DataInterface, isArrayOf, isNullOrUndefined, TypeCheck } from "common/u
|
|||||||
|
|
||||||
export class GenericInterfaceModelDB {
|
export class GenericInterfaceModelDB {
|
||||||
constructor(
|
constructor(
|
||||||
protected serviceName:string,
|
protected serviceName: string,
|
||||||
protected http: HttpWrapperService,
|
protected http: HttpWrapperService,
|
||||||
protected bdd: BddService) {
|
protected bdd: BddService) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
@ -16,7 +16,7 @@ export class GenericInterfaceModelDB {
|
|||||||
self.bdd.get(self.serviceName)
|
self.bdd.get(self.serviceName)
|
||||||
.then((response: DataInterface) => {
|
.then((response: DataInterface) => {
|
||||||
let data = response.gets();
|
let data = response.gets();
|
||||||
if(isNullOrUndefined(data)) {
|
if (isNullOrUndefined(data)) {
|
||||||
reject('Data does not exist in the local BDD');
|
reject('Data does not exist in the local BDD');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -28,13 +28,13 @@ export class GenericInterfaceModelDB {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getLike(nameArtist:string):any {
|
getLike(nameArtist: string): any {
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.get(self.serviceName)
|
self.bdd.get(self.serviceName)
|
||||||
.then((response:DataInterface) => {
|
.then((response: DataInterface) => {
|
||||||
let data = response.getNameLike(nameArtist);
|
let data = response.getNameLike(nameArtist);
|
||||||
if(data === null || data === undefined || data.length === 0) {
|
if (data === null || data === undefined || data.length === 0) {
|
||||||
reject('Data does not exist in the local BDD');
|
reject('Data does not exist in the local BDD');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -56,26 +56,26 @@ export class GenericInterfaceModelDB {
|
|||||||
key: 'id',
|
key: 'id',
|
||||||
value: [undefined, null],
|
value: [undefined, null],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[ 'name', 'id' ]);
|
['name', 'id']);
|
||||||
//data = response.gets();
|
//data = response.gets();
|
||||||
if (isArrayOf(data, isNodeData)) {
|
if (isArrayOf(data, isNodeData)) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}
|
}
|
||||||
reject("The model is wrong ...");
|
reject("The model is wrong ...");
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
console.log(`[E] ${ self.constructor.name }: can not retrive BDD values`);
|
console.log(`[E] ${self.constructor.name}: can not retrive BDD values`);
|
||||||
reject(response);
|
reject(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
get(id:number): Promise<NodeData> {
|
get(id: number): Promise<NodeData> {
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.get(self.serviceName)
|
self.bdd.get(self.serviceName)
|
||||||
.then((response: DataInterface) => {
|
.then((response: DataInterface) => {
|
||||||
let data = response.get(id);
|
let data = response.get(id);
|
||||||
if(isNullOrUndefined(data)) {
|
if (isNullOrUndefined(data)) {
|
||||||
reject('Data does not exist in the local BDD');
|
reject('Data does not exist in the local BDD');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,13 +92,13 @@ export class GenericInterfaceModelDB {
|
|||||||
self.bdd.get(self.serviceName)
|
self.bdd.get(self.serviceName)
|
||||||
.then((response: DataInterface) => {
|
.then((response: DataInterface) => {
|
||||||
let data = response.getsWhere([
|
let data = response.getsWhere([
|
||||||
{
|
{
|
||||||
check: TypeCheck.EQUAL,
|
check: TypeCheck.EQUAL,
|
||||||
key: 'id',
|
key: 'id',
|
||||||
value: ids,
|
value: ids,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[ 'name', 'id' ]);
|
['name', 'id']);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
return;
|
return;
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
@ -111,11 +111,11 @@ export class GenericInterfaceModelDB {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.bdd.get(self.serviceName)
|
self.bdd.get(self.serviceName)
|
||||||
.then((response:DataInterface) => {
|
.then((response: DataInterface) => {
|
||||||
let data = response.gets();
|
let data = response.gets();
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
console.log(`[E] ${ self.constructor.name }: can not retrive BDD values`);
|
console.log(`[E] ${self.constructor.name}: can not retrive BDD values`);
|
||||||
reject(response);
|
reject(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -124,25 +124,25 @@ export class GenericInterfaceModelDB {
|
|||||||
insert(data: any): any {
|
insert(data: any): any {
|
||||||
let ret = this.http.postSpecific([this.serviceName], data);
|
let ret = this.http.postSpecific([this.serviceName], data);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(id:number):any {
|
delete(id: number): any {
|
||||||
let ret = this.http.deleteSpecific([this.serviceName, id]);
|
let ret = this.http.deleteSpecific([this.serviceName, id]);
|
||||||
return this.bdd.delete(this.serviceName, id, ret);
|
return this.bdd.delete(this.serviceName, id, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCover(nodeId:number, coverId:number) {
|
deleteCover(nodeId: number, coverId: number) {
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.http.getSpecific([this.serviceName, nodeId, 'rm_cover', coverId])
|
self.http.getSpecific([this.serviceName, nodeId, 'rm_cover', coverId])
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
let data = response;
|
let data = response;
|
||||||
if(data === null || data === undefined) {
|
if (data === null || data === undefined) {
|
||||||
reject('error retrive data from server');
|
reject('error retrive data from server');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -153,19 +153,19 @@ export class GenericInterfaceModelDB {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
uploadCover(file:File,
|
uploadCover(file: File,
|
||||||
nodeId:number,
|
nodeId: number,
|
||||||
progress:any = null) {
|
progress: any = null) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('fileName', file.name);
|
formData.append('fileName', file.name);
|
||||||
formData.append('id', nodeId.toString());
|
formData.append('id', nodeId.toString());
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
let self = this;
|
let self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.http.uploadMultipart(`${this.serviceName }/${nodeId}/add_cover/`, formData, progress)
|
self.http.uploadMultipart(`${this.serviceName}/${nodeId}/add_cover/`, formData, progress)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
let data = response;
|
let data = response;
|
||||||
if(data === null || data === undefined) {
|
if (data === null || data === undefined) {
|
||||||
reject('error retrive data from server');
|
reject('error retrive data from server');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user