diff --git a/.island/release.bash b/.island/release.bash
index d9e1927..00d16da 100755
--- a/.island/release.bash
+++ b/.island/release.bash
@@ -5,7 +5,7 @@ version_file="../version.txt"
# update new release dependency
cd back
# update the Maven version number
-mvn versions:set -DnewVersion=$(sed 's/DEV/SNAPSHOT/g' $version_file)
+mvn versions:set -DnewVersion=$(sed 's/dev/SNAPSHOT/g' $version_file)
if grep -q "DEV" "$version_file"; then
# update all versions release of dependency
mvn versions:use-latest-releases
@@ -19,11 +19,14 @@ cd -
cd front
-if grep -q "DEV" "$version_file"; then
+if grep -q "dev" "$version_file"; then
# update all dependency
pnpm install
pnpm run update_packages
else
# in case of release ==> can not do it automatically ...
+ echo not implemented
fi
+
cd -
+
diff --git a/Dockerfile b/Dockerfile
index dc0e490..e0379e6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -59,15 +59,6 @@ FROM bellsoft/liberica-openjdk-alpine:latest
# add wget to manage the health check...
RUN apk add --no-cache wget
-#FROM archlinux:base
-#RUN pacman -Syu --noconfirm && pacman-db-upgrade
-## install package
-#RUN pacman -S --noconfirm jdk-openjdk wget
-## intall npm
-#RUN pacman -S --noconfirm npm
-## clean all the caches Need only on the release environment
-#RUN pacman -Scc --noconfirm
-
ENV LANG=C.UTF-8
COPY --from=buildBack /tmp/out/maven/*.jar /application/application.jar
diff --git a/back/pom.xml b/back/pom.xml
index b64a289..3a58770 100644
--- a/back/pom.xml
+++ b/back/pom.xml
@@ -20,17 +20,17 @@
kangaroo-and-rabbit
archidata
- 0.8.4
+ 0.12.0
org.slf4j
slf4j-simple
- 2.0.9
+ 2.1.0-alpha1
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
- 2.16.1
+ 2.17.1
-
+
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ 4.8.5.0
+
+ spotbugs-security-include.xml
+ spotbugs-security-exclude.xml
+
+
+
diff --git a/back/src/org/kar/karideo/WebLauncher.java b/back/src/org/kar/karideo/WebLauncher.java
index f1a5297..16264ca 100755
--- a/back/src/org/kar/karideo/WebLauncher.java
+++ b/back/src/org/kar/karideo/WebLauncher.java
@@ -10,10 +10,7 @@ import org.glassfish.jersey.server.ResourceConfig;
import org.kar.archidata.GlobalConfiguration;
import org.kar.archidata.UpdateJwtPublicKey;
import org.kar.archidata.api.DataResource;
-import org.kar.archidata.catcher.ExceptionCatcher;
-import org.kar.archidata.catcher.FailExceptionCatcher;
-import org.kar.archidata.catcher.InputExceptionCatcher;
-import org.kar.archidata.catcher.SystemExceptionCatcher;
+import org.kar.archidata.catcher.GenericCatcher;
import org.kar.archidata.db.DBConfig;
import org.kar.archidata.filter.CORSFilter;
import org.kar.archidata.filter.OptionFilter;
@@ -95,10 +92,7 @@ public class WebLauncher {
// global authentication system
rc.register(KarideoAuthenticationFilter.class);
// register exception catcher
- rc.register(InputExceptionCatcher.class);
- rc.register(SystemExceptionCatcher.class);
- rc.register(FailExceptionCatcher.class);
- rc.register(ExceptionCatcher.class);
+ GenericCatcher.addAll(rc);
// add default resource:
rc.register(UserResource.class);
rc.register(SeriesResource.class);
@@ -114,7 +108,7 @@ public class WebLauncher {
// add jackson to be discover when we are ins stand-alone server
rc.register(JacksonFeature.class);
// enable this to show low level request
- //rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
+ // rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
this.server = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc);
final HttpServer serverLink = this.server;
diff --git a/back/src/org/kar/karideo/WebLauncherLocal.java b/back/src/org/kar/karideo/WebLauncherLocal.java
index 19f7f57..e04e70b 100755
--- a/back/src/org/kar/karideo/WebLauncherLocal.java
+++ b/back/src/org/kar/karideo/WebLauncherLocal.java
@@ -4,7 +4,8 @@ package org.kar.karideo;
import java.util.List;
import org.kar.archidata.api.DataResource;
-import org.kar.archidata.dataAccess.DataFactoryTsApi;
+import org.kar.archidata.externalRestApi.AnalyzeApi;
+import org.kar.archidata.externalRestApi.TsGenerateApi;
import org.kar.archidata.tools.ConfigBaseVariable;
import org.kar.karideo.api.Front;
import org.kar.karideo.api.HealthCheck;
@@ -14,7 +15,6 @@ import org.kar.karideo.api.SeriesResource;
import org.kar.karideo.api.TypeResource;
import org.kar.karideo.api.UserMediaAdvancementResource;
import org.kar.karideo.api.UserResource;
-import org.kar.karideo.migration.Initialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,18 +23,18 @@ public class WebLauncherLocal extends WebLauncher {
private WebLauncherLocal() {}
+ public static void generateObjects() throws Exception {
+ LOGGER.info("Generate APIs");
+ final List> listOfResources = List.of(Front.class, HealthCheck.class, SeasonResource.class, SeriesResource.class, TypeResource.class, UserMediaAdvancementResource.class,
+ UserResource.class, MediaResource.class, DataResource.class);
+ final AnalyzeApi api = new AnalyzeApi();
+ api.addAllApi(listOfResources);
+ TsGenerateApi.generateApi(api, "../front/src/app/back-api/");
+ LOGGER.info("Generate APIs (DONE)");
+ }
+
public static void main(final String[] args) throws Exception {
- DataFactoryTsApi.generatePackage(List.of(
- Front.class,
- HealthCheck.class,
- SeasonResource.class,
- SeriesResource.class,
- TypeResource.class,
- UserMediaAdvancementResource.class,
- UserResource.class,
- MediaResource.class,
- DataResource.class),
- Initialization.CLASSES_BASE, "../front/src/app/back-api/");
+ generateObjects();
final WebLauncherLocal launcher = new WebLauncherLocal();
launcher.process();
LOGGER.info("end-configure the server & wait finish process:");
diff --git a/back/src/org/kar/karideo/api/Front.java b/back/src/org/kar/karideo/api/Front.java
index 4212114..dd28177 100644
--- a/back/src/org/kar/karideo/api/Front.java
+++ b/back/src/org/kar/karideo/api/Front.java
@@ -1,6 +1,5 @@
package org.kar.karideo.api;
-
import org.kar.archidata.api.FrontGeneric;
import jakarta.ws.rs.Path;
@@ -11,6 +10,6 @@ import org.kar.karideo.util.ConfigVariable;
public class Front extends FrontGeneric {
public Front() {
this.baseFrontFolder = ConfigVariable.getFrontFolder();
-
+
}
}
diff --git a/back/src/org/kar/karideo/api/MediaResource.java b/back/src/org/kar/karideo/api/MediaResource.java
index 3432a27..fc47f88 100644
--- a/back/src/org/kar/karideo/api/MediaResource.java
+++ b/back/src/org/kar/karideo/api/MediaResource.java
@@ -89,14 +89,14 @@ public class MediaResource {
@FormDataParam("fileName") String fileName, //
@FormDataParam("universe") String universe, //
@FormDataParam("series") String series, //
- //@FormDataParam("seriesId") String seriesId, // Not used ...
+ // @FormDataParam("seriesId") String seriesId, // Not used ...
@FormDataParam("season") String season, //
@FormDataParam("episode") String episode, //
@FormDataParam("title") String title, //
@FormDataParam("typeId") String typeId, //
@FormDataParam("file") final InputStream fileInputStream, //
@FormDataParam("file") final FormDataContentDisposition fileMetaData //
- ) throws FailException {
+ ) throws FailException {
try {
// correct input string stream :
fileName = multipartCorrection(fileName);
@@ -107,7 +107,7 @@ public class MediaResource {
title = multipartCorrection(title);
typeId = multipartCorrection(typeId);
- //public NodeSmall uploadFile(final FormDataMultiPart form) {
+ // public NodeSmall uploadFile(final FormDataMultiPart form) {
LOGGER.info("Upload media file: {}", fileMetaData);
LOGGER.info(" - fileName: {}", fileName);
LOGGER.info(" - universe: {}", universe);
@@ -136,7 +136,7 @@ public class MediaResource {
ex.printStackTrace();
throw new FailException("can not create input media (the data model has an internal error");
}
- } else if (data!= null && data.deleted != null && data.deleted) {
+ } else if (data != null && data.deleted != null && data.deleted) {
LOGGER.info("Data already exist but deleted");
System.out.flush();
DataTools.undelete(data.uuid);
@@ -222,7 +222,7 @@ public class MediaResource {
@FormDataParam("fileName") final String fileName, //
@FormDataParam("file") final InputStream fileInputStream, //
@FormDataParam("file") final FormDataContentDisposition fileMetaData//
- ) throws Exception {
+ ) throws Exception {
DataTools.uploadCover(Media.class, id, fileName, fileInputStream, fileMetaData);
return DataAccess.get(Media.class, id);
}
@@ -234,7 +234,7 @@ public class MediaResource {
public Media removeCover( //
@PathParam("id") final Long id, //
@PathParam("coverId") final UUID coverId //
- ) throws Exception {
+ ) throws Exception {
AddOnDataJson.removeLink(Media.class, id, "covers", coverId);
return DataAccess.get(Media.class, id);
}
diff --git a/back/src/org/kar/karideo/api/SeasonResource.java b/back/src/org/kar/karideo/api/SeasonResource.java
index 6ed952a..895ffe0 100644
--- a/back/src/org/kar/karideo/api/SeasonResource.java
+++ b/back/src/org/kar/karideo/api/SeasonResource.java
@@ -35,7 +35,6 @@ import jakarta.ws.rs.core.MediaType;
public class SeasonResource {
static final Logger LOGGER = LoggerFactory.getLogger(SeasonResource.class);
-
@GET
@RolesAllowed("USER")
@Operation(description = "Get a specific Season with his ID", tags = "GLOBAL")
@@ -52,9 +51,7 @@ public class SeasonResource {
return DataAccess.get(Season.class, id);
}
- /* =============================================================================
- * ADMIN SECTION:
- * ============================================================================= */
+ /* ============================================================================= ADMIN SECTION: ============================================================================= */
@POST
@RolesAllowed("ADMIN")
diff --git a/back/src/org/kar/karideo/api/SeriesResource.java b/back/src/org/kar/karideo/api/SeriesResource.java
index cbf53c5..89e333c 100644
--- a/back/src/org/kar/karideo/api/SeriesResource.java
+++ b/back/src/org/kar/karideo/api/SeriesResource.java
@@ -51,9 +51,7 @@ public class SeriesResource {
return DataAccess.get(Series.class, id);
}
- /* =============================================================================
- * ADMIN SECTION:
- * ============================================================================= */
+ /* ============================================================================= ADMIN SECTION: ============================================================================= */
@POST
@RolesAllowed("ADMIN")
diff --git a/back/src/org/kar/karideo/api/TypeResource.java b/back/src/org/kar/karideo/api/TypeResource.java
index 2b4ee5d..5c942aa 100644
--- a/back/src/org/kar/karideo/api/TypeResource.java
+++ b/back/src/org/kar/karideo/api/TypeResource.java
@@ -34,7 +34,6 @@ import jakarta.ws.rs.core.MediaType;
public class TypeResource {
static final Logger LOGGER = LoggerFactory.getLogger(TypeResource.class);
-
@GET
@RolesAllowed("USER")
@Operation(description = "Get all Type", tags = "GLOBAL")
@@ -55,9 +54,7 @@ public class TypeResource {
return DataAccess.get(Type.class, id);
}
- /* =============================================================================
- * ADMIN SECTION:
- * ============================================================================= */
+ /* ============================================================================= ADMIN SECTION: ============================================================================= */
@POST
@RolesAllowed("ADMIN")
diff --git a/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java b/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java
index 33ecce4..3e7836d 100644
--- a/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java
+++ b/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java
@@ -46,19 +46,15 @@ public class UserMediaAdvancementResource {
return DataAccess.getsWhere(UserMediaAdvancement.class, new Condition(new QueryCondition("userId", "=", gc.userByToken.id)));
}
- /* =============================================================================
- * Modification SECTION:
- * ============================================================================= */
+ /* ============================================================================= Modification SECTION: ============================================================================= */
- public record MediaInformations(
- int time,
- float percent,
- int count) {}
+ public record MediaInformations(int time, float percent, int count) {
+ }
- //@POST
- //@Path("{id}")
- //@RolesAllowed("USER")
- //@Consumes(MediaType.APPLICATION_JSON)
+ // @POST
+ // @Path("{id}")
+ // @RolesAllowed("USER")
+ // @Consumes(MediaType.APPLICATION_JSON)
public UserMediaAdvancement post(@Context final SecurityContext sc, @PathParam("id") final Long id, final MediaInformations data) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
final UserMediaAdvancement elem = new UserMediaAdvancement();
@@ -70,10 +66,8 @@ public class UserMediaAdvancementResource {
return DataAccess.insert(elem);
}
- public record MediaInformationsDelta(
- int time,
- float percent,
- boolean addCount) {}
+ public record MediaInformationsDelta(int time, float percent, boolean addCount) {
+ }
@PATCH
@Path("{id}")
diff --git a/back/src/org/kar/karideo/filter/KarideoAuthenticationFilter.java b/back/src/org/kar/karideo/filter/KarideoAuthenticationFilter.java
index 8d57271..79fdcad 100644
--- a/back/src/org/kar/karideo/filter/KarideoAuthenticationFilter.java
+++ b/back/src/org/kar/karideo/filter/KarideoAuthenticationFilter.java
@@ -15,9 +15,9 @@ import jakarta.annotation.Priority;
@Priority(Priorities.AUTHENTICATION)
public class KarideoAuthenticationFilter extends AuthenticationFilter {
final Logger logger = LoggerFactory.getLogger(KarideoAuthenticationFilter.class);
-
- public KarideoAuthenticationFilter() {
+
+ public KarideoAuthenticationFilter() {
super("karideo");
}
-
+
}
diff --git a/back/src/org/kar/karideo/internal/Log.java b/back/src/org/kar/karideo/internal/Log.java
index 411653b..71d6346 100644
--- a/back/src/org/kar/karideo/internal/Log.java
+++ b/back/src/org/kar/karideo/internal/Log.java
@@ -4,57 +4,57 @@ package org.kar.karideo.internal;
//import io.scenarium.logger.Logger;
public class Log {
-// private static final String LIB_NAME = "logger";
-// private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
-// private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
-// private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
-// private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
-// private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
-// private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
-// private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
-// private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
-// private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
-//
-// private Log() {}
-//
-// public static void print(String data) {
-// if (PRINT_PRINT)
-// Logger.print(LIB_NAME_DRAW, data);
-// }
-//
-// public static void todo(String data) {
-// if (PRINT_TODO)
-// Logger.todo(LIB_NAME_DRAW, data);
-// }
-//
-// public static void critical(String data) {
-// if (PRINT_CRITICAL)
-// Logger.critical(LIB_NAME_DRAW, data);
-// }
-//
-// public static void error(String data) {
-// if (PRINT_ERROR)
-// Logger.error(LIB_NAME_DRAW, data);
-// }
-//
-// public static void warning(String data) {
-// if (PRINT_WARNING)
-// Logger.warning(LIB_NAME_DRAW, data);
-// }
-//
-// public static void info(String data) {
-// if (PRINT_INFO)
-// Logger.info(LIB_NAME_DRAW, data);
-// }
-//
-// public static void debug(String data) {
-// if (PRINT_DEBUG)
-// Logger.debug(LIB_NAME_DRAW, data);
-// }
-//
-// public static void verbose(String data) {
-// if (PRINT_VERBOSE)
-// Logger.verbose(LIB_NAME_DRAW, data);
-// }
+ // private static final String LIB_NAME = "logger";
+ // private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
+ // private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
+ // private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
+ // private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
+ // private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
+ // private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
+ // private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
+ // private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
+ // private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
+ //
+ // private Log() {}
+ //
+ // public static void print(String data) {
+ // if (PRINT_PRINT)
+ // Logger.print(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void todo(String data) {
+ // if (PRINT_TODO)
+ // Logger.todo(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void critical(String data) {
+ // if (PRINT_CRITICAL)
+ // Logger.critical(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void error(String data) {
+ // if (PRINT_ERROR)
+ // Logger.error(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void warning(String data) {
+ // if (PRINT_WARNING)
+ // Logger.warning(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void info(String data) {
+ // if (PRINT_INFO)
+ // Logger.info(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void debug(String data) {
+ // if (PRINT_DEBUG)
+ // Logger.debug(LIB_NAME_DRAW, data);
+ // }
+ //
+ // public static void verbose(String data) {
+ // if (PRINT_VERBOSE)
+ // Logger.verbose(LIB_NAME_DRAW, data);
+ // }
}
diff --git a/back/src/org/kar/karideo/migration/Initialization.java b/back/src/org/kar/karideo/migration/Initialization.java
index 9ea17ea..f4ea112 100644
--- a/back/src/org/kar/karideo/migration/Initialization.java
+++ b/back/src/org/kar/karideo/migration/Initialization.java
@@ -2,6 +2,7 @@ package org.kar.karideo.migration;
import java.util.List;
+import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.migration.MigrationSqlStep;
import org.kar.archidata.model.Data;
import org.kar.archidata.model.User;
@@ -10,12 +11,16 @@ import org.kar.karideo.model.Season;
import org.kar.karideo.model.Series;
import org.kar.karideo.model.Type;
import org.kar.karideo.model.UserMediaAdvancement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class Initialization extends MigrationSqlStep {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Initialization.class);
public static final int KARSO_INITIALISATION_ID = 1;
public static final List> CLASSES_BASE = List.of(Data.class, Media.class, Type.class, Series.class, Season.class, User.class, UserMediaAdvancement.class);
+
@Override
public String getName() {
return "Initialization";
@@ -27,7 +32,7 @@ public class Initialization extends MigrationSqlStep {
@Override
public void generateStep() throws Exception {
- for(final Class> clazz : CLASSES_BASE) {
+ for (final Class> clazz : CLASSES_BASE) {
addClass(clazz);
}
@@ -62,4 +67,25 @@ public class Initialization extends MigrationSqlStep {
""", "mysql");
}
+ public static void dropAll() {
+ for (final Class> element : CLASSES_BASE) {
+ try {
+ DataAccess.drop(element);
+ } catch (final Exception ex) {
+ LOGGER.error("Fail to drop table !!!!!!");
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public static void cleanAll() {
+ for (final Class> element : CLASSES_BASE) {
+ try {
+ DataAccess.cleanAll(element);
+ } catch (final Exception ex) {
+ LOGGER.error("Fail to clean table !!!!!!");
+ ex.printStackTrace();
+ }
+ }
+ }
}
diff --git a/back/src/org/kar/karideo/migration/Migration20230810.java b/back/src/org/kar/karideo/migration/Migration20230810.java
index 8ae79c6..892af80 100644
--- a/back/src/org/kar/karideo/migration/Migration20230810.java
+++ b/back/src/org/kar/karideo/migration/Migration20230810.java
@@ -4,25 +4,25 @@ import org.kar.archidata.migration.MigrationSqlStep;
import org.kar.karideo.model.UserMediaAdvancement;
public class Migration20230810 extends MigrationSqlStep {
-
+
public static final int KARSO_INITIALISATION_ID = 1;
-
+
@Override
public String getName() {
return "migration-2023-08-10";
}
-
+
public Migration20230810() {
-
+
}
-
+
@Override
public void generateStep() throws Exception {
addClass(UserMediaAdvancement.class);
-
+
addAction("""
ALTER TABLE `userMediaAdvancement` AUTO_INCREMENT = 1000;
""");
}
-
+
}
diff --git a/back/src/org/kar/karideo/migration/Migration20231126.java b/back/src/org/kar/karideo/migration/Migration20231126.java
index a2543b1..4c54bb2 100644
--- a/back/src/org/kar/karideo/migration/Migration20231126.java
+++ b/back/src/org/kar/karideo/migration/Migration20231126.java
@@ -17,7 +17,7 @@ public class Migration20231126 extends MigrationSqlStep {
@Override
public void generateStep() throws Exception {
-
+
// update migration update (last one)
addAction("""
ALTER TABLE `KAR_migration`
diff --git a/back/src/org/kar/karideo/migration/Migration20240226.java b/back/src/org/kar/karideo/migration/Migration20240226.java
index f460800..f231158 100644
--- a/back/src/org/kar/karideo/migration/Migration20240226.java
+++ b/back/src/org/kar/karideo/migration/Migration20240226.java
@@ -42,10 +42,10 @@ public class Migration20240226 extends MigrationSqlStep {
""");
addAction(() -> {
final List datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
- for (final UUIDConversion elem: datas) {
+ for (final UUIDConversion elem : datas) {
elem.uuid = UuidUtils.nextUUID();
}
- for (final UUIDConversion elem: datas) {
+ for (final UUIDConversion elem : datas) {
DataAccess.update(elem, elem.id, List.of("uuid"), new OverrideTableName("data"));
}
});
@@ -53,18 +53,18 @@ public class Migration20240226 extends MigrationSqlStep {
ALTER TABLE `data` CHANGE `uuid` `uuid` binary(16) DEFAULT (UUID_TO_BIN(UUID(), TRUE));
""");
final List tableToTransform = List.of("media", "season", "series", "type", "user");
- for (final String tableName : tableToTransform ) {
+ for (final String tableName : tableToTransform) {
addAction("ALTER TABLE `" + tableName + "` ADD `covers` text NULL;");
addAction(() -> {
final List datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
final List medias = DataAccess.gets(CoverConversion.class, new AccessDeletedItems(), new OverrideTableName(tableName));
final List links = DataAccess.gets(LinkTableLongLong.class, new OverrideTableName(tableName + "_link_cover"));
LOGGER.info("Get somes data: {} {} {}", datas.size(), medias.size(), links.size());
- for (final CoverConversion media: medias) {
+ for (final CoverConversion media : medias) {
final List values = new ArrayList<>();
- for (final LinkTableLongLong link: links) {
+ for (final LinkTableLongLong link : links) {
if (link.object1Id.equals(media.id)) {
- for (final UUIDConversion data: datas) {
+ for (final UUIDConversion data : datas) {
if (data.id.equals(link.object2Id)) {
values.add(data.uuid);
break;
@@ -88,8 +88,8 @@ public class Migration20240226 extends MigrationSqlStep {
addAction(() -> {
final List datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
final List medias = DataAccess.gets(MediaConversion.class, new AccessDeletedItems(), new OverrideTableName("media"));
- for (final MediaConversion media: medias) {
- for (final UUIDConversion data: datas) {
+ for (final MediaConversion media : medias) {
+ for (final UUIDConversion data : datas) {
if (data.id.equals(media.dataId)) {
media.dataUUID = data.uuid;
DataAccess.update(media, media.id, List.of("dataUUID"), new OverrideTableName("media"));
@@ -107,7 +107,7 @@ public class Migration20240226 extends MigrationSqlStep {
// Move the files...
addAction(() -> {
final List datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
- for (final UUIDConversion data: datas) {
+ for (final UUIDConversion data : datas) {
final String origin = DataResource.getFileDataOld(data.id);
final String destination = DataResource.getFileData(data.uuid);
LOGGER.info("move file = {}", origin);
@@ -119,11 +119,7 @@ public class Migration20240226 extends MigrationSqlStep {
}
}
});
- /* I am not sure then I prefer keep the primary key for the moment
- addAction("""
- ALTER TABLE `data` DROP `id`;
- """);
- */
+ /* I am not sure then I prefer keep the primary key for the moment addAction(""" ALTER TABLE `data` DROP `id`; """); */
addAction("""
ALTER TABLE `data` CHANGE `id` `idOld` bigint NOT NULL DEFAULT 0;
""");
diff --git a/back/src/org/kar/karideo/model/Media.java b/back/src/org/kar/karideo/model/Media.java
index 502adf4..58c2234 100644
--- a/back/src/org/kar/karideo/model/Media.java
+++ b/back/src/org/kar/karideo/model/Media.java
@@ -9,6 +9,7 @@ import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
@@ -19,43 +20,41 @@ import jakarta.persistence.Table;
@Table(name = "media")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Media extends GenericDataSoftDelete {
- // Name of the media (this represent the title)
+ @Schema(description = "Name of the media (this represent the title)")
@Column(nullable = false, length = 0)
public String name;
- // Description of the media
+ @Schema(description = "Description of the media")
@Column(length = 0)
public String description;
- // Foreign Key Id of the data
+ @Schema(description = "Foreign Key Id of the data")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Data.class)
@Column(nullable = false)
public UUID dataId;
- // Type of the media")
+ @Schema(description = "Type of the media")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Type.class)
public Long typeId;
- // Series reference of the media
+ @Schema(description = "Series reference of the media")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Series.class)
public Long seriesId;
- // Season reference of the media
+ @Schema(description = "Season reference of the media")
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Season.class)
public Long seasonId;
- // Episode Id
+ @Schema(description = "Episode Id")
public Integer episode;
// ")
public Integer date;
- // Creation years of the media
+ @Schema(description = "Creation years of the media")
public Integer time;
- // Limitation Age of the media
+ @Schema(description = "Limitation Age of the media")
public Integer ageLimit;
- // List of Id of the specific covers
+ @Schema(description = "List of Id of the specific covers")
@DataJson(targetEntity = Data.class)
public List covers = null;
@Override
public String toString() {
- return "Media [name=" + this.name + ", description=" + this.description + ", dataId=" + this.dataId + ", typeId=" + this.typeId
- + ", seriesId=" + this.seriesId + ", seasonId=" + this.seasonId + ", episode=" + this.episode + ", date=" + this.date
- + ", time=" + this.time + ", ageLimit=" + this.ageLimit + ", covers=" + this.covers + "]";
+ return "Media [name=" + this.name + ", description=" + this.description + ", dataId=" + this.dataId + ", typeId=" + this.typeId + ", seriesId=" + this.seriesId + ", seasonId=" + this.seasonId
+ + ", episode=" + this.episode + ", date=" + this.date + ", time=" + this.time + ", ageLimit=" + this.ageLimit + ", covers=" + this.covers + "]";
}
-
}
diff --git a/back/src/org/kar/karideo/util/ConfigVariable.java b/back/src/org/kar/karideo/util/ConfigVariable.java
index 1aa9764..6a727cb 100644
--- a/back/src/org/kar/karideo/util/ConfigVariable.java
+++ b/back/src/org/kar/karideo/util/ConfigVariable.java
@@ -2,12 +2,12 @@ package org.kar.karideo.util;
public class ConfigVariable {
public static final String BASE_NAME = "ORG_KARIDEO_";
-
- public static String getFrontFolder() {
- String out = System.getenv(BASE_NAME + "FRONT_FOLDER");
- if (out == null) {
- return "/application/front";
- }
- return out;
- }
+
+ public static String getFrontFolder() {
+ String out = System.getenv(BASE_NAME + "FRONT_FOLDER");
+ if (out == null) {
+ return "/application/front";
+ }
+ return out;
+ }
}
diff --git a/back/test/src/test/kar/karideo/TestHealthCheck.java b/back/test/src/test/kar/karideo/TestHealthCheck.java
index 83ef767..fd2a425 100644
--- a/back/test/src/test/kar/karideo/TestHealthCheck.java
+++ b/back/test/src/test/kar/karideo/TestHealthCheck.java
@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class TestHealthCheck {
private final static Logger LOGGER = LoggerFactory.getLogger(TestHealthCheck.class);
-
+
static WebLauncherTest webInterface = null;
static RESTApi api = null;
@@ -42,7 +42,7 @@ public class TestHealthCheck {
LOGGER.info("Start REST (DONE)");
api = new RESTApi(ConfigBaseVariable.apiAdress);
}
-
+
@AfterAll
public static void stopWebServer() throws InterruptedException, IOException {
LOGGER.info("Kill the web server");
@@ -52,19 +52,19 @@ public class TestHealthCheck {
DBEntry.closeAllForceMode();
ConfigBaseVariable.clearAllValue();
}
-
+
@Order(1)
@Test
- //@RepeatedTest(10)
+ // @RepeatedTest(10)
public void checkHealthCheck() throws Exception {
final HealthResult result = api.get(HealthResult.class, "health_check");
Assertions.assertEquals(result.value(), "alive and kicking");
}
-
+
@Order(2)
@Test
public void checkHealthCheckWrongAPI() throws Exception {
Assertions.assertThrows(RESTErrorResponseExeption.class, () -> api.get(HealthResult.class, "health_checks"));
}
-
+
}
diff --git a/back/test/src/test/kar/karideo/WebLauncherTest.java b/back/test/src/test/kar/karideo/WebLauncherTest.java
index f3bcd1e..930c089 100755
--- a/back/test/src/test/kar/karideo/WebLauncherTest.java
+++ b/back/test/src/test/kar/karideo/WebLauncherTest.java
@@ -8,21 +8,27 @@ import org.slf4j.LoggerFactory;
public class WebLauncherTest extends WebLauncher {
final private static Logger LOGGER = LoggerFactory.getLogger(WebLauncherTest.class);
-
+
public WebLauncherTest() {
LOGGER.debug("Configure REST system");
// for local test:
- ConfigBaseVariable.apiAdress = "http://127.0.0.1:12345/test/api/";
+ ConfigBaseVariable.apiAdress = "http://127.0.0.1:12342/test/api/";
+ // Enable the test mode permit to access to the test token (never use it in production).
ConfigBaseVariable.testMode = "true";
- //ConfigBaseVariable.dbPort = "3306";
// for the test we a in memory sqlite..
- ConfigBaseVariable.dbType = "sqlite";
- ConfigBaseVariable.dbHost = "memory";
- // for test we need to connect all time the DB
- ConfigBaseVariable.dbKeepConnected = "true";
-
- //ConfigBaseVariable.dbHost = "localhost";
- //ConfigBaseVariable.dbUser = "root";
- //ConfigBaseVariable.dbPassword = "ZERTYSDGFVHSDFGHJYZSDFGSQxfgsqdfgsqdrf4564654";
+ if (true) {
+ if (!"true".equalsIgnoreCase(System.getenv("TEST_E2E_MODE"))) {
+ ConfigBaseVariable.dbType = "sqlite";
+ ConfigBaseVariable.dbHost = "memory";
+ // for test we need to connect all time the DB
+ ConfigBaseVariable.dbKeepConnected = "true";
+ }
+ } else {
+ // Enable this if you want to access to a local MySQL base to test with an adminer
+ ConfigBaseVariable.bdDatabase = "test_db";
+ ConfigBaseVariable.dbPort = "3309";
+ ConfigBaseVariable.dbUser = "root";
+ ConfigBaseVariable.dbPassword = "password";
+ }
}
}
diff --git a/front/package.json b/front/package.json
index ab5707a..d4aaaa1 100644
--- a/front/package.json
+++ b/front/package.json
@@ -19,32 +19,32 @@
},
"private": true,
"dependencies": {
- "@angular/animations": "^17.3.5",
- "@angular/cdk": "^17.3.5",
- "@angular/common": "^17.3.5",
- "@angular/compiler": "^17.3.5",
- "@angular/core": "^17.3.5",
- "@angular/forms": "^17.3.5",
- "@angular/material": "^17.3.5",
- "@angular/platform-browser": "^17.3.5",
- "@angular/platform-browser-dynamic": "^17.3.5",
- "@angular/router": "^17.3.5",
+ "@angular/animations": "^18.0.2",
+ "@angular/cdk": "^18.0.2",
+ "@angular/common": "^18.0.2",
+ "@angular/compiler": "^18.0.2",
+ "@angular/core": "^18.0.2",
+ "@angular/forms": "^18.0.2",
+ "@angular/material": "^18.0.2",
+ "@angular/platform-browser": "^18.0.2",
+ "@angular/platform-browser-dynamic": "^18.0.2",
+ "@angular/router": "^18.0.2",
"rxjs": "^7.8.1",
- "zone.js": "^0.14.4",
- "zod": "3.23.0",
- "@kangaroo-and-rabbit/kar-cw": "^0.2.1"
+ "zone.js": "^0.14.6",
+ "zod": "3.23.8",
+ "@kangaroo-and-rabbit/kar-cw": "^0.4.1"
},
"devDependencies": {
- "@angular-devkit/build-angular": "^17.3.5",
- "@angular-eslint/builder": "17.3.0",
- "@angular-eslint/eslint-plugin": "17.3.0",
- "@angular-eslint/eslint-plugin-template": "17.3.0",
- "@angular-eslint/schematics": "17.3.0",
- "@angular-eslint/template-parser": "17.3.0",
- "@angular/cli": "^17.3.5",
- "@angular/compiler-cli": "^17.3.5",
- "@angular/language-service": "^17.3.5",
- "npm-check-updates": "^16.14.18",
- "tslib": "^2.6.2"
+ "@angular-devkit/build-angular": "^18.0.3",
+ "@angular-eslint/builder": "18.0.1",
+ "@angular-eslint/eslint-plugin": "18.0.1",
+ "@angular-eslint/eslint-plugin-template": "18.0.1",
+ "@angular-eslint/schematics": "18.0.1",
+ "@angular-eslint/template-parser": "18.0.1",
+ "@angular/cli": "^18.0.3",
+ "@angular/compiler-cli": "^18.0.2",
+ "@angular/language-service": "^18.0.2",
+ "npm-check-updates": "^16.14.20",
+ "tslib": "^2.6.3"
}
}
\ No newline at end of file
diff --git a/front/src/app/back-api/data-resource.ts b/front/src/app/back-api/api/data-resource.ts
similarity index 73%
rename from front/src/app/back-api/data-resource.ts
rename to front/src/app/back-api/api/data-resource.ts
index c68f8d1..61891c1 100644
--- a/front/src/app/back-api/data-resource.ts
+++ b/front/src/app/back-api/api/data-resource.ts
@@ -1,21 +1,108 @@
/**
- * API of the server (auto-generated code)
+ * Interface of the server (auto-generated code)
*/
import {
- HTTPMimeType,
- HTTPRequestModel,
- ModelResponseHttp,
- RESTCallbacks,
- RESTConfig,
- RESTRequestJson,
- RESTRequestJsonArray,
- RESTRequestVoid
-} from "./rest-tools"
+ HTTPMimeType,
+ HTTPRequestModel,
+ RESTConfig,
+ RESTRequestJson,
+ RESTRequestVoid,
+} from "../rest-tools";
+
import {
- UUID,
-} from "./model"
+ UUID,
+} from "../model";
+
export namespace DataResource {
+ /**
+ * Get back some data from the data environment (with a beautiful name (permit download with basic name)
+ */
+ export function retrieveDataFull({
+ restConfig,
+ queries,
+ params,
+ data,
+ }: {
+ restConfig: RESTConfig,
+ queries: {
+ Authorization?: string,
+ },
+ params: {
+ name: string,
+ uuid: UUID,
+ },
+ data: string,
+ }): Promise