From 5e8b244ebdd0a00548a46ab249611c13d25eddd6 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 27 Feb 2024 08:01:42 +0100 Subject: [PATCH] [DEV] work on uuid conversion --- back/pom.xml | 2 +- back/src/org/kar/karideo/WebLauncher.java | 3 +- .../org/kar/karideo/api/SeasonResource.java | 25 +- .../org/kar/karideo/api/SeriesResource.java | 3 +- .../org/kar/karideo/api/VideoResource.java | 33 +-- .../kar/karideo/migration/Initialization.java | 20 +- .../karideo/migration/Migration20240226.java | 44 ++++ .../migration/model/UUIDConversion.java | 11 + back/src/org/kar/karideo/model/Media.java | 19 +- back/src/org/kar/karideo/model/Season.java | 14 +- back/src/org/kar/karideo/model/Series.java | 14 +- back/src/org/kar/karideo/model/Type.java | 13 +- front/angular.json | 227 ++++++++++-------- front/src/app/model/user-media-advancement.ts | 3 +- front/src/app/scene/video/video.ts | 2 +- 15 files changed, 262 insertions(+), 171 deletions(-) create mode 100644 back/src/org/kar/karideo/migration/Migration20240226.java create mode 100644 back/src/org/kar/karideo/migration/model/UUIDConversion.java diff --git a/back/pom.xml b/back/pom.xml index 216ff23..bd7a1c0 100644 --- a/back/pom.xml +++ b/back/pom.xml @@ -20,7 +20,7 @@ kangaroo-and-rabbit archidata - 0.6.1 + 0.6.3 org.slf4j diff --git a/back/src/org/kar/karideo/WebLauncher.java b/back/src/org/kar/karideo/WebLauncher.java index cfef1cf..dc54114 100755 --- a/back/src/org/kar/karideo/WebLauncher.java +++ b/back/src/org/kar/karideo/WebLauncher.java @@ -32,6 +32,7 @@ import org.kar.karideo.migration.Initialization; import org.kar.karideo.migration.Migration20230810; import org.kar.karideo.migration.Migration20231015; import org.kar.karideo.migration.Migration20231126; +import org.kar.karideo.migration.Migration20240226; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +61,7 @@ public class WebLauncher { migrationEngine.add(new Migration20230810()); migrationEngine.add(new Migration20231015()); migrationEngine.add(new Migration20231126()); - //migrationEngine.add(new Migration20231126()); + migrationEngine.add(new Migration20240226()); WebLauncher.LOGGER.info("Migrate the DB [START]"); migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig); WebLauncher.LOGGER.info("Migrate the DB [STOP]"); diff --git a/back/src/org/kar/karideo/api/SeasonResource.java b/back/src/org/kar/karideo/api/SeasonResource.java index 62ec4b6..4f06f41 100644 --- a/back/src/org/kar/karideo/api/SeasonResource.java +++ b/back/src/org/kar/karideo/api/SeasonResource.java @@ -2,6 +2,7 @@ package org.kar.karideo.api; import java.io.InputStream; import java.util.List; +import java.util.UUID; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -31,20 +32,20 @@ import jakarta.ws.rs.core.Response; @Produces({ MediaType.APPLICATION_JSON }) public class SeasonResource { static final Logger LOGGER = LoggerFactory.getLogger(SeasonResource.class); - + @GET @Path("{id}") @RolesAllowed("USER") public static Season getWithId(@PathParam("id") final Long id) throws Exception { return DataAccess.get(Season.class, id); } - + @GET @RolesAllowed("USER") public List get() throws Exception { return DataAccess.gets(Season.class); } - + @GET @Path("{id}") @RolesAllowed("USER") @@ -52,18 +53,18 @@ public class SeasonResource { public Season get(@PathParam("id") final Long id) throws Exception { return DataAccess.get(Season.class, id); } - + /* ============================================================================= * ADMIN SECTION: * ============================================================================= */ - + @POST @RolesAllowed("ADMIN") @Consumes(MediaType.APPLICATION_JSON) public Season put(final String jsonRequest) throws Exception { return DataAccess.insertWithJson(Season.class, jsonRequest); } - + @PATCH @Path("{id}") @RolesAllowed("ADMIN") @@ -72,7 +73,7 @@ public class SeasonResource { DataAccess.updateWithJson(Season.class, id, jsonRequest); return DataAccess.get(Season.class, id); } - + @DELETE @Path("{id}") @RolesAllowed("ADMIN") @@ -80,7 +81,7 @@ public class SeasonResource { DataAccess.delete(Season.class, id); return Response.ok().build(); } - + @POST @Path("{id}/add_cover") @RolesAllowed("ADMIN") @@ -89,7 +90,7 @@ public class SeasonResource { @FormDataParam("file") final FormDataContentDisposition fileMetaData) { return DataTools.uploadCover(Season.class, id, fileName, fileInputStream, fileMetaData); } - + @GET @Path("{id}/rm_cover/{coverId}") @RolesAllowed("ADMIN") @@ -97,8 +98,8 @@ public class SeasonResource { AddOnManyToMany.removeLink(Season.class, id, "cover", coverId); 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 UUID seriesId) { try { Season out = DataAccess.getWhere(Season.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId)))); if (out == null) { @@ -114,5 +115,5 @@ public class SeasonResource { } return null; } - + } diff --git a/back/src/org/kar/karideo/api/SeriesResource.java b/back/src/org/kar/karideo/api/SeriesResource.java index c8a6d6d..c295a05 100644 --- a/back/src/org/kar/karideo/api/SeriesResource.java +++ b/back/src/org/kar/karideo/api/SeriesResource.java @@ -2,6 +2,7 @@ package org.kar.karideo.api; import java.io.InputStream; import java.util.List; +import java.util.UUID; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -98,7 +99,7 @@ public class SeriesResource { 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 UUID typeId) { try { Series out = DataAccess.getWhere(Series.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId)))); if (out == null) { diff --git a/back/src/org/kar/karideo/api/VideoResource.java b/back/src/org/kar/karideo/api/VideoResource.java index 5508f04..9780bdb 100644 --- a/back/src/org/kar/karideo/api/VideoResource.java +++ b/back/src/org/kar/karideo/api/VideoResource.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.util.List; +import java.util.UUID; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -37,20 +38,20 @@ import jakarta.ws.rs.core.Response; @Produces({ MediaType.APPLICATION_JSON }) public class VideoResource { static final Logger LOGGER = LoggerFactory.getLogger(VideoResource.class); - + @GET @RolesAllowed("USER") public List get() throws Exception { return DataAccess.gets(Media.class); } - + @GET @Path("{id}") @RolesAllowed("USER") public Media get(@PathParam("id") final Long id) throws Exception { return DataAccess.get(Media.class, id); } - + @PATCH @Path("{id}") @RolesAllowed("ADMIN") @@ -60,7 +61,7 @@ public class VideoResource { DataAccess.updateWithJson(Media.class, id, jsonRequest); return DataAccess.get(Media.class, id); } - + private String multipartCorrection(final String data) { if (data == null) { return null; @@ -73,7 +74,7 @@ public class VideoResource { } return data; } - + @POST @Path("/upload/") @RolesAllowed("ADMIN") @@ -91,7 +92,7 @@ public class VideoResource { episode = multipartCorrection(episode); title = multipartCorrection(title); typeId = multipartCorrection(typeId); - + //public NodeSmall uploadFile(final FormDataMultiPart form) { System.out.println("Upload media file: " + fileMetaData); System.out.println(" - fileName: " + fileName); @@ -107,7 +108,7 @@ public class VideoResource { if (typeId == null) { throw new InputException("typeId", "TypiId is not specified"); } - + final long tmpUID = DataResource.getTmpDataId(); final String sha512 = DataResource.saveTemporaryFile(fileInputStream, tmpUID); Data data = DataResource.getWithSha512(sha512); @@ -145,7 +146,7 @@ public class VideoResource { if (series != null) { seriesNode = SeriesResource.getOrCreate(series, typeNode.id); } - + System.out.println(" ==> " + seriesNode); System.out.println("Find seasonNode"); // get uid of season: @@ -157,10 +158,10 @@ public class VideoResource { if (season != null) { seasonNode = SeasonResource.getOrCreate(season, seriesNode.id); } - + System.out.println(" ==> " + seasonNode); System.out.println("add media"); - + final long uniqueSQLID = -1; try { final Media media = new Media(); @@ -195,28 +196,28 @@ public class VideoResource { throw new FailException("Catch Exception ==> check server logs"); } } - + @POST @Path("{id}/add_cover") @RolesAllowed("ADMIN") @Consumes({ MediaType.MULTIPART_FORM_DATA }) - public Response uploadCover(@PathParam("id") final Long id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream, + public Response uploadCover(@PathParam("id") final UUID id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream, @FormDataParam("file") final FormDataContentDisposition fileMetaData) { return DataTools.uploadCover(Media.class, id, fileName, fileInputStream, fileMetaData); } - + @GET @Path("{id}/rm_cover/{coverId}") @RolesAllowed("ADMIN") - public Response removeCover(@PathParam("id") final Long id, @PathParam("coverId") final Long coverId) throws Exception { + public Response removeCover(@PathParam("id") final UUID id, @PathParam("coverId") final UUID coverId) throws Exception { AddOnManyToMany.removeLink(Media.class, id, "cover", coverId); return Response.ok(DataAccess.get(Media.class, id)).build(); } - + @DELETE @Path("{id}") @RolesAllowed("ADMIN") - public Response delete(@PathParam("id") final Long id) throws Exception { + public Response delete(@PathParam("id") final UUID id) throws Exception { DataAccess.delete(Media.class, id); return Response.ok().build(); } diff --git a/back/src/org/kar/karideo/migration/Initialization.java b/back/src/org/kar/karideo/migration/Initialization.java index 26f3028..e916bc0 100644 --- a/back/src/org/kar/karideo/migration/Initialization.java +++ b/back/src/org/kar/karideo/migration/Initialization.java @@ -34,16 +34,16 @@ public class Initialization extends MigrationSqlStep { addAction(""" INSERT INTO `type` (`id`, `name`, `description`) VALUES - (1, 'Documentary', 'Documentary (animals, space, earth...)'), - (2, 'Movie', 'Movie with real humans (film)'), - (3, 'Animation', 'Animation movies (film)'), - (4, 'Short movie', 'Small movies (less 2 minutes)'), - (5, 'TV show', 'TV show for old peoples'), - (6, 'Animation TV show', 'TV show for young peoples'), - (7, 'Theater', 'Theater play'), - (8, 'One man show', 'Recorded stand up'), - (9, 'Concert', 'Recorded concert'), - (10, 'Opera', 'Recorded opera'); + (UUID_TO_BIN('15237fd7-d4ee-11ee-a8dd-02420a030203'), 'Documentary', 'Documentary (animals, space, earth...)'), + (UUID_TO_BIN('553146c1-d4ee-11ee-a8dd-02420a030203'), 'Movie', 'Movie with real humans (film)'), + (UUID_TO_BIN('59c430a3-d4ee-11ee-a8dd-02420a030203'), 'Animation', 'Animation movies (film)'), + (UUID_TO_BIN('5cd619e3-d4ee-11ee-a8dd-02420a030203'), 'Short movie', 'Small movies (less 2 minutes)'), + (UUID_TO_BIN('5fbbf085-d4ee-11ee-a8dd-02420a030203'), 'TV show', 'TV show for old peoples'), + (UUID_TO_BIN('66dcb6ba-d4ee-11ee-a8dd-02420a030203'), 'Animation TV show', 'TV show for young peoples'), + (UUID_TO_BIN('69ee5c15-d4ee-11ee-a8dd-02420a030203'), 'Theater', 'Theater play'), + (UUID_TO_BIN('6ce72530-d4ee-11ee-a8dd-02420a030203'), 'One man show', 'Recorded stand up'), + (UUID_TO_BIN('6ff1691a-d4ee-11ee-a8dd-02420a030203'), 'Concert', 'Recorded concert'), + (UUID_TO_BIN('730815ef-d4ee-11ee-a8dd-02420a030203'), 'Opera', 'Recorded opera'); """); // set start increment element to permit to add after default elements addAction(""" diff --git a/back/src/org/kar/karideo/migration/Migration20240226.java b/back/src/org/kar/karideo/migration/Migration20240226.java new file mode 100644 index 0000000..02a1e1f --- /dev/null +++ b/back/src/org/kar/karideo/migration/Migration20240226.java @@ -0,0 +1,44 @@ +package org.kar.karideo.migration; + +import java.util.List; +import java.util.UUID; + +import org.kar.archidata.dataAccess.DataAccess; +import org.kar.archidata.dataAccess.options.AccessDeletedItems; +import org.kar.archidata.dataAccess.options.OverrideTableName; +import org.kar.archidata.migration.MigrationSqlStep; +import org.kar.karideo.migration.model.UUIDConversion; + +public class Migration20240226 extends MigrationSqlStep { + + public static final int KARSO_INITIALISATION_ID = 1; + + @Override + public String getName() { + return "migration-2024-02-26: convert base with UUID"; + } + + public Migration20240226() { + + } + + @Override + public void generateStep() throws Exception { + + // update migration update (last one) + addAction(""" + ALTER TABLE `media` ADD `uuid` binary(16) AFTER `id`; + """); + addAction(() -> { + final List medias = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("media")); + for (final UUIDConversion elem: medias) { + elem.uuid = UUID.randomUUID(); + } + for (final UUIDConversion elem: medias) { + DataAccess.update(elem, elem.id, List.of("uuid"), new OverrideTableName("media")); + } + }); + + } + +} diff --git a/back/src/org/kar/karideo/migration/model/UUIDConversion.java b/back/src/org/kar/karideo/migration/model/UUIDConversion.java new file mode 100644 index 0000000..a6e43c4 --- /dev/null +++ b/back/src/org/kar/karideo/migration/model/UUIDConversion.java @@ -0,0 +1,11 @@ +package org.kar.karideo.migration.model; + +import java.util.UUID; + +import jakarta.persistence.Id; + +public class UUIDConversion { + @Id + public Long id = null; + public UUID uuid = null; +} diff --git a/back/src/org/kar/karideo/model/Media.java b/back/src/org/kar/karideo/model/Media.java index c80ab49..a2978f7 100644 --- a/back/src/org/kar/karideo/model/Media.java +++ b/back/src/org/kar/karideo/model/Media.java @@ -1,16 +1,17 @@ package org.kar.karideo.model; import java.util.List; +import java.util.UUID; +import org.kar.archidata.annotation.DataJson; import org.kar.archidata.model.Data; -import org.kar.archidata.model.GenericDataSoftDelete; +import org.kar.archidata.model.UUIDGenericDataSoftDelete; import com.fasterxml.jackson.annotation.JsonInclude; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; -import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; @@ -19,7 +20,7 @@ import jakarta.persistence.Table; @JsonInclude(JsonInclude.Include.NON_NULL) //@SQLDelete(sql = "UPDATE table_product SET deleted = true WHERE id=?") //@Where(clause = "deleted=false") -public class Media extends GenericDataSoftDelete { +public class Media extends UUIDGenericDataSoftDelete { // Name of the media (this represent the title) @Column(nullable = false, length = 0) public String name; @@ -29,16 +30,16 @@ public class Media extends GenericDataSoftDelete { // Foreign Key Id of the data @ManyToOne(fetch = FetchType.LAZY, targetEntity = Data.class) @Column(nullable = false) - public Long dataId; + public UUID dataId; // Type of the media") @ManyToOne(fetch = FetchType.LAZY, targetEntity = Type.class) - public Long typeId; + public UUID typeId; // Series reference of the media @ManyToOne(fetch = FetchType.LAZY, targetEntity = Series.class) - public Long seriesId; + public UUID seriesId; // Saison reference of the media @ManyToOne(fetch = FetchType.LAZY, targetEntity = Season.class) - public Long seasonId; + public UUID seasonId; // Episide Id public Integer episode; // ") @@ -48,6 +49,6 @@ public class Media extends GenericDataSoftDelete { // Limitation Age of the media public Integer ageLimit; // List of Id of the specific covers - @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) - public List covers = null; + @DataJson() + public List covers = null; } diff --git a/back/src/org/kar/karideo/model/Season.java b/back/src/org/kar/karideo/model/Season.java index ef19342..03bd30c 100644 --- a/back/src/org/kar/karideo/model/Season.java +++ b/back/src/org/kar/karideo/model/Season.java @@ -1,24 +1,24 @@ package org.kar.karideo.model; import java.util.List; +import java.util.UUID; import org.kar.archidata.annotation.DataIfNotExists; -import org.kar.archidata.model.Data; -import org.kar.archidata.model.GenericDataSoftDelete; +import org.kar.archidata.annotation.DataJson; +import org.kar.archidata.model.UUIDGenericDataSoftDelete; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Column; import jakarta.persistence.FetchType; -import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; @Table(name = "season") @DataIfNotExists @JsonInclude(JsonInclude.Include.NON_NULL) -public class Season extends GenericDataSoftDelete { +public class Season extends UUIDGenericDataSoftDelete { @Column(nullable = false, length = 0) @Schema(description = "Name of the media (this represent the title)") public String name; @@ -28,8 +28,8 @@ public class Season extends GenericDataSoftDelete { @Column(nullable = false) @Schema(description = "series parent ID") @ManyToOne(fetch = FetchType.LAZY, targetEntity = Series.class) - public Long parentId; + public UUID parentId; @Schema(description = "List of Id of the sopecific covers") - @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) - public List covers = null; + @DataJson() + public List covers = null; } \ No newline at end of file diff --git a/back/src/org/kar/karideo/model/Series.java b/back/src/org/kar/karideo/model/Series.java index cf89d02..f9d0c00 100644 --- a/back/src/org/kar/karideo/model/Series.java +++ b/back/src/org/kar/karideo/model/Series.java @@ -1,24 +1,24 @@ package org.kar.karideo.model; import java.util.List; +import java.util.UUID; import org.kar.archidata.annotation.DataIfNotExists; -import org.kar.archidata.model.Data; -import org.kar.archidata.model.GenericDataSoftDelete; +import org.kar.archidata.annotation.DataJson; +import org.kar.archidata.model.UUIDGenericDataSoftDelete; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Column; import jakarta.persistence.FetchType; -import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; @Table(name = "series") @DataIfNotExists @JsonInclude(JsonInclude.Include.NON_NULL) -public class Series extends GenericDataSoftDelete { +public class Series extends UUIDGenericDataSoftDelete { @Column(nullable = false, length = 0) @Schema(description = "Name of the media (this represent the title)") public String name; @@ -28,8 +28,8 @@ public class Series extends GenericDataSoftDelete { @Column(nullable = false) @Schema(description = "series parent ID") @ManyToOne(fetch = FetchType.LAZY, targetEntity = Type.class) - public Long parentId; + public UUID parentId; @Schema(description = "List of Id of the sopecific covers") - @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) - public List covers = null; + @DataJson() + public List covers = null; } diff --git a/back/src/org/kar/karideo/model/Type.java b/back/src/org/kar/karideo/model/Type.java index 5a387f6..051eeab 100644 --- a/back/src/org/kar/karideo/model/Type.java +++ b/back/src/org/kar/karideo/model/Type.java @@ -1,23 +1,22 @@ package org.kar.karideo.model; import java.util.List; +import java.util.UUID; import org.kar.archidata.annotation.DataIfNotExists; -import org.kar.archidata.model.Data; -import org.kar.archidata.model.GenericDataSoftDelete; +import org.kar.archidata.annotation.DataJson; +import org.kar.archidata.model.UUIDGenericDataSoftDelete; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Column; -import jakarta.persistence.FetchType; -import jakarta.persistence.ManyToMany; import jakarta.persistence.Table; @Table(name = "type") @DataIfNotExists @JsonInclude(JsonInclude.Include.NON_NULL) -public class Type extends GenericDataSoftDelete { +public class Type extends UUIDGenericDataSoftDelete { @Column(nullable = false, length = 0) @Schema(description = "Name of the media (this represent the title)") public String name; @@ -25,6 +24,6 @@ public class Type extends GenericDataSoftDelete { @Schema(description = "Description of the media") public String description; @Schema(description = "List of Id of the sopecific covers") - @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) - public List covers = null; + @DataJson() + public List covers = null; } diff --git a/front/angular.json b/front/angular.json index 023bec3..15825e3 100644 --- a/front/angular.json +++ b/front/angular.json @@ -1,88 +1,112 @@ { - "$schema" : "./node_modules/@angular/cli/lib/config/schema.json", - "version" : 1, - "newProjectRoot" : "projects", - "defaultProject" : "karideo", - "projects" : { - "karideo" : { - "root" : "", - "sourceRoot" : "src", - "projectType" : "application", - "architect" : { - "build" : { - "builder" : "@angular-devkit/build-angular:browser", - "options" : { - "outputPath" : "dist", - "index" : "src/index.html", - "main" : "src/main.ts", - "tsConfig" : "src/tsconfig.app.json", - "polyfills" : "src/polyfills.ts", - "assets" : [ "src/assets", "src/favicon.ico" ], - "styles" : [ "src/styles.less", "src/generic_page.less", "src/theme.color.blue.less", "src/theme.checkbox.less", "src/theme.modal.less" ], - "scripts" : [ ] + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "defaultProject": "karideo", + "projects": { + "karideo": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist", + "index": "src/index.html", + "main": "src/main.ts", + "tsConfig": "src/tsconfig.app.json", + "polyfills": [ + "zone.js" + ], + "assets": [ + "src/assets", + "src/favicon.ico" + ], + "styles": [ + "src/styles.less", + "src/generic_page.less", + "src/theme.color.blue.less", + "src/theme.checkbox.less", + "src/theme.modal.less" + ], + "scripts": [] }, - "configurations" : { - "production" : { - "optimization" : true, - "outputHashing" : "all", - "sourceMap" : false, - "namedChunks" : false, - "aot" : true, - "extractLicenses" : true, - "vendorChunk" : false, - "buildOptimizer" : true, - "fileReplacements" : [ { - "replace" : "src/environments/environment.ts", - "with" : "src/environments/environment.prod.ts" - } ] + "configurations": { + "production": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ] }, - "develop" : { - "optimization" : false, - "outputHashing" : "none", - "sourceMap" : true, - "namedChunks" : true, - "aot" : true, - "extractLicenses" : true, - "vendorChunk" : true, - "buildOptimizer" : false + "develop": { + "optimization": false, + "outputHashing": "none", + "sourceMap": true, + "namedChunks": true, + "aot": true, + "extractLicenses": true, + "vendorChunk": true, + "buildOptimizer": false } } }, - "serve" : { - "builder" : "@angular-devkit/build-angular:dev-server", - "options" : { - "browserTarget" : "karideo:build" + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "karideo:build" }, - "configurations" : { - "production" : { - "browserTarget" : "karideo:build:production" + "configurations": { + "production": { + "browserTarget": "karideo:build:production" }, - "develop" : { - "browserTarget" : "karideo:build:develop" + "develop": { + "browserTarget": "karideo:build:develop" } } }, - "extract-i18n" : { - "builder" : "@angular-devkit/build-angular:extract-i18n", - "options" : { - "browserTarget" : "karideo:build" + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "karideo:build" } }, - "test" : { - "builder" : "@angular-devkit/build-angular:karma", - "options" : { - "main" : "src/test.ts", - "karmaConfig" : "./karma.conf.js", - "polyfills" : "src/polyfills.ts", - "tsConfig" : "src/tsconfig.spec.json", - "scripts" : [ ], - "styles" : [ "src/styles.less", "src/generic_page.less", "src/theme.color.blue.less", "src/theme.checkbox.less", "src/theme.modal.less" ], - "assets" : [ "src/assets", "src/favicon.ico" ] + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "karmaConfig": "./karma.conf.js", + "polyfills": [ + "zone.js" + ], + "tsConfig": "src/tsconfig.spec.json", + "scripts": [], + "styles": [ + "src/styles.less", + "src/generic_page.less", + "src/theme.color.blue.less", + "src/theme.checkbox.less", + "src/theme.modal.less" + ], + "assets": [ + "src/assets", + "src/favicon.ico" + ] } }, - "lint" : { - "builder" : "@angular-eslint/builder:lint", - "options" : { + "lint": { + "builder": "@angular-eslint/builder:lint", + "options": { "fix": true, "eslintConfig": ".eslintrc.js", "lintFilePatterns": [ @@ -91,44 +115,53 @@ ] } }, - "TTTTTTlint" : { - "builder" : "@angular-devkit/build-angular:tslint", - "options" : { - "tsConfig" : [ "src/tsconfig.app.json", "src/tsconfig.spec.json" ], - "exclude" : [ "**/node_modules/**" ] + "TTTTTTlint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.app.json", + "src/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] } } } }, - "karideo-e2e" : { - "root" : "e2e", - "sourceRoot" : "e2e", - "projectType" : "application", - "architect" : { - "e2e" : { - "builder" : "@angular-devkit/build-angular:protractor", - "options" : { - "protractorConfig" : "./protractor.conf.js", - "devServerTarget" : "karideo:serve" + "karideo-e2e": { + "root": "e2e", + "sourceRoot": "e2e", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "./protractor.conf.js", + "devServerTarget": "karideo:serve" } }, - "lint" : { - "builder" : "@angular-devkit/build-angular:tslint", - "options" : { - "tsConfig" : [ "e2e/tsconfig.e2e.json" ], - "exclude" : [ "**/node_modules/**" ] + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "e2e/tsconfig.e2e.json" + ], + "exclude": [ + "**/node_modules/**" + ] } } } } }, - "schematics" : { - "@schematics/angular:component" : { - "prefix" : "app", - "style" : "less" + "schematics": { + "@schematics/angular:component": { + "prefix": "app", + "style": "less" }, - "@schematics/angular:directive" : { - "prefix" : "app" + "@schematics/angular:directive": { + "prefix": "app" } } -} +} \ No newline at end of file diff --git a/front/src/app/model/user-media-advancement.ts b/front/src/app/model/user-media-advancement.ts index 0846675..ec60e55 100644 --- a/front/src/app/model/user-media-advancement.ts +++ b/front/src/app/model/user-media-advancement.ts @@ -1,5 +1,4 @@ -import { isNumberFinite, isString, isOptionalOf, isNumber } from "common/utils"; -import { isNodeData, NodeData } from "common/model/node"; +import { isNumberFinite, isNumber } from "common/utils"; export interface UserMediaAdvancement { diff --git a/front/src/app/scene/video/video.ts b/front/src/app/scene/video/video.ts index 48285ff..d4128e7 100644 --- a/front/src/app/scene/video/video.ts +++ b/front/src/app/scene/video/video.ts @@ -74,7 +74,7 @@ export class VideoScene implements OnInit { timeLeft: number = 10; interval = null; - userMetaData: UserMediaAdvancement & { percentDisplay: number } = undefined + userMetaData: UserMediaAdvancement & { percentDisplay?: number } = undefined previousTime: number = 0; startPlayingTime: number = undefined;