diff --git a/back/src/org/kar/karusic/WebLauncher.java b/back/src/org/kar/karusic/WebLauncher.java index f50ffa6..e301330 100755 --- a/back/src/org/kar/karusic/WebLauncher.java +++ b/back/src/org/kar/karusic/WebLauncher.java @@ -17,7 +17,7 @@ import org.kar.archidata.catcher.SystemExceptionCatcher; import org.kar.archidata.filter.CORSFilter; import org.kar.archidata.filter.OptionFilter; import org.kar.archidata.migration.MigrationEngine; -import org.kar.archidata.util.ConfigBaseVariable; +import org.kar.archidata.tools.ConfigBaseVariable; import org.kar.karusic.api.AlbumResource; import org.kar.karusic.api.ArtistResource; import org.kar.karusic.api.Front; @@ -28,6 +28,7 @@ import org.kar.karusic.api.TrackResource; import org.kar.karusic.api.UserResource; import org.kar.karusic.filter.KarusicAuthenticationFilter; import org.kar.karusic.migration.Initialization; +import org.kar.karusic.migration.Migration20231126; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +53,7 @@ public class WebLauncher { WebLauncher.LOGGER.info("Add initialization"); migrationEngine.setInit(new Initialization()); WebLauncher.LOGGER.info("Add migration since last version"); - // NOTHING for now + migrationEngine.add(new Migration20231126()); 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/karusic/WebLauncherLocal.java b/back/src/org/kar/karusic/WebLauncherLocal.java index 1c80303..aef9a96 100755 --- a/back/src/org/kar/karusic/WebLauncherLocal.java +++ b/back/src/org/kar/karusic/WebLauncherLocal.java @@ -1,37 +1,39 @@ package org.kar.karusic; -import org.kar.archidata.util.ConfigBaseVariable; -import org.slf4j.LoggerFactory; +import org.kar.archidata.tools.ConfigBaseVariable; import org.slf4j.Logger; - +import org.slf4j.LoggerFactory; public class WebLauncherLocal extends WebLauncher { final Logger logger = LoggerFactory.getLogger(WebLauncherLocal.class); + private WebLauncherLocal() {} - - public static void main(String[] args) throws InterruptedException { - WebLauncherLocal launcher = new WebLauncherLocal(); + + public static void main(final String[] args) throws InterruptedException { + final WebLauncherLocal launcher = new WebLauncherLocal(); launcher.process(); launcher.logger.info("end-configure the server & wait finish process:"); Thread.currentThread().join(); launcher.logger.info("STOP the REST server:"); } - + @Override public void process() throws InterruptedException { if (true) { // for local test: ConfigBaseVariable.apiAdress = "http://0.0.0.0:19080/karusic/api/"; - ConfigBaseVariable.ssoAdress = "https://atria-soft.org/karso/api/"; + //ConfigBaseVariable.ssoAdress = "https://atria-soft.org/karso/api/"; + ConfigBaseVariable.dbPort = "3307"; } try { super.migrateDB(); - } catch (Exception e) { - // TODO Auto-generated catch block + } catch (final Exception e) { e.printStackTrace(); while (true) { - logger.error("Migration fail ==> waiting intervention of administrator..."); - Thread.sleep(60*60*1000); + LOGGER.error("============================================================================"); + LOGGER.error("== Migration fail ==> waiting intervention of administrator..."); + LOGGER.error("============================================================================"); + Thread.sleep(60 * 60 * 1000); } } super.process(); diff --git a/back/src/org/kar/karusic/api/AlbumResource.java b/back/src/org/kar/karusic/api/AlbumResource.java index 6f8a5e8..c29574f 100644 --- a/back/src/org/kar/karusic/api/AlbumResource.java +++ b/back/src/org/kar/karusic/api/AlbumResource.java @@ -7,7 +7,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karusic.model.Album; import jakarta.annotation.security.RolesAllowed; diff --git a/back/src/org/kar/karusic/api/ArtistResource.java b/back/src/org/kar/karusic/api/ArtistResource.java index 650d647..d83da4e 100644 --- a/back/src/org/kar/karusic/api/ArtistResource.java +++ b/back/src/org/kar/karusic/api/ArtistResource.java @@ -7,7 +7,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karusic.model.Artist; import jakarta.annotation.security.RolesAllowed; diff --git a/back/src/org/kar/karusic/api/GenderResource.java b/back/src/org/kar/karusic/api/GenderResource.java index 2957b65..ce4ec59 100644 --- a/back/src/org/kar/karusic/api/GenderResource.java +++ b/back/src/org/kar/karusic/api/GenderResource.java @@ -7,7 +7,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karusic.model.Gender; import jakarta.annotation.security.RolesAllowed; diff --git a/back/src/org/kar/karusic/api/HealthCheck.java b/back/src/org/kar/karusic/api/HealthCheck.java index 5a1ec09..720993a 100644 --- a/back/src/org/kar/karusic/api/HealthCheck.java +++ b/back/src/org/kar/karusic/api/HealthCheck.java @@ -1,8 +1,8 @@ package org.kar.karusic.api; import org.kar.archidata.exception.FailException; -import org.kar.archidata.util.ConfigBaseVariable; -import org.kar.archidata.util.JWTWrapper; +import org.kar.archidata.tools.ConfigBaseVariable; +import org.kar.archidata.tools.JWTWrapper; import jakarta.annotation.security.PermitAll; import jakarta.ws.rs.GET; diff --git a/back/src/org/kar/karusic/api/PlaylistResource.java b/back/src/org/kar/karusic/api/PlaylistResource.java index 995e05f..367fcac 100644 --- a/back/src/org/kar/karusic/api/PlaylistResource.java +++ b/back/src/org/kar/karusic/api/PlaylistResource.java @@ -7,7 +7,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karusic.model.Playlist; import jakarta.annotation.security.RolesAllowed; diff --git a/back/src/org/kar/karusic/api/TrackResource.java b/back/src/org/kar/karusic/api/TrackResource.java index 3432a6f..f63c2a8 100644 --- a/back/src/org/kar/karusic/api/TrackResource.java +++ b/back/src/org/kar/karusic/api/TrackResource.java @@ -12,7 +12,7 @@ import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; import org.kar.archidata.model.Data; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karusic.model.Album; import org.kar.karusic.model.Artist; import org.kar.karusic.model.Gender; diff --git a/back/src/org/kar/karusic/migration/Migration20231126.java b/back/src/org/kar/karusic/migration/Migration20231126.java new file mode 100644 index 0000000..afa8b8e --- /dev/null +++ b/back/src/org/kar/karusic/migration/Migration20231126.java @@ -0,0 +1,169 @@ +package org.kar.karusic.migration; + +import org.kar.archidata.migration.MigrationSqlStep; + +public class Migration20231126 extends MigrationSqlStep { + + public static final int KARSO_INITIALISATION_ID = 1; + + @Override + public String getName() { + return "migration-2023-11-26: reorder the migration for the new API of archidata"; + } + + public Migration20231126() { + + } + + @Override + public void generateStep() throws Exception { + // update migration update (last one) + addAction(""" + ALTER TABLE `KAR_migration` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + ADD `version` int NOT NULL DEFAULT '2' AFTER `deleted`, + CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL COMMENT 'Name of the migration' AFTER `version`, + CHANGE `terminated` `terminated` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'if the migration is well terminated or not' AFTER `name`, + CHANGE `stepId` `stepId` int NULL COMMENT 'index in the migration progression' AFTER `terminated`, + CHANGE `count` `count` int NULL COMMENT 'number of element in the migration' AFTER `stepId`, + CHANGE `log` `log` text COLLATE 'utf8mb3_general_ci' NULL COMMENT 'Log generate by the migration' AFTER `count`; + """); + + addAction(""" + ALTER TABLE `album` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `deleted`, + CHANGE `description` `description` text COLLATE 'utf8mb3_general_ci' NULL AFTER `name`, + CHANGE `publication` `publication` date NULL AFTER `description`; + """); + addAction(""" + ALTER TABLE `album_link_cover` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `album_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `cover_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `artist` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + CHANGE `firstName` `firstName` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `description`, + CHANGE `surname` `surname` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `firstName`, + CHANGE `birth` `birth` date NULL AFTER `surname`, + CHANGE `death` `death` date NULL AFTER `birth`; + """); + addAction(""" + ALTER TABLE `artist_link_cover` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `artist_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `cover_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `data` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + CHANGE `sha512` `sha512` varchar(128) COLLATE 'utf8mb4_0900_ai_ci' NOT NULL COMMENT 'Sha512 of the data' AFTER `deleted`, + CHANGE `mimeType` `mimeType` varchar(128) COLLATE 'utf8mb4_0900_ai_ci' NOT NULL COMMENT 'Mime -type of the media' AFTER `sha512`, + CHANGE `size` `size` bigint NOT NULL COMMENT 'Size in Byte of the data' AFTER `mimeType`; + """); + addAction(""" + ALTER TABLE `gender` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `deleted`, + CHANGE `description` `description` text COLLATE 'utf8mb3_general_ci' NULL AFTER `name`; + """); + addAction(""" + ALTER TABLE `gender_link_cover` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `gender_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `cover_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `playlist` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `deleted`, + CHANGE `description` `description` text COLLATE 'utf8mb3_general_ci' NULL AFTER `name`; + """); + addAction(""" + ALTER TABLE `playlist_link_cover` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `playlist_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `cover_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `playlist_link_track` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `playlist_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `track_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `track` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + CHANGE `name` `name` varchar(256) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `deleted`, + CHANGE `description` `description` text COLLATE 'utf8mb3_general_ci' NULL AFTER `name`, + CHANGE `genderId` `genderId` bigint NULL AFTER `description`, + CHANGE `albumId` `albumId` bigint NULL AFTER `genderId`, + CHANGE `track` `track` bigint NULL AFTER `albumId`, + CHANGE `dataId` `dataId` bigint NULL AFTER `track`, + CHANGE `artists` `artists` text COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `dataId`; + """); + addAction(""" + ALTER TABLE `track_link_cover` + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' AFTER `updatedAt`, + CHANGE `track_id` `object1id` bigint NOT NULL AFTER `deleted`, + CHANGE `cover_id` `object2id` bigint NOT NULL AFTER `object1id`; + """); + addAction(""" + ALTER TABLE `user` + CHANGE `id` `id` bigint NOT NULL COMMENT 'Primary key of the base' AUTO_INCREMENT FIRST, + CHANGE `create_date` `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' AFTER `id`, + CHANGE `modify_date` `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'When update the object' AFTER `createdAt`, + CHANGE `deleted` `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' AFTER `updatedAt`, + CHANGE `login` `login` varchar(128) COLLATE 'utf8mb4_0900_ai_ci' NULL AFTER `deleted`, + CHANGE `lastConnection` `lastConnection` timestamp(3) NULL AFTER `login`, + CHANGE `admin` `admin` tinyint(1) NOT NULL DEFAULT '0' AFTER `lastConnection`, + CHANGE `blocked` `blocked` tinyint(1) NOT NULL DEFAULT '0' AFTER `admin`, + CHANGE `removed` `removed` tinyint(1) NOT NULL DEFAULT '0' AFTER `blocked`; + """); + addAction(""" + CREATE TABLE `user_link_cover` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary key of the base' , + `createdAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Create time of the object' , + `updatedAt` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT 'When update the object' , + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'When delete, they are not removed, they are just set in a deleted state' , + `object1Id` bigint NOT NULL COMMENT 'Object reference 1' , + `object2Id` bigint NOT NULL COMMENT 'Object reference 2' , + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + """); + } + +} diff --git a/back/src/org/kar/karusic/model/Album.java b/back/src/org/kar/karusic/model/Album.java index f5ac1b4..6364c9d 100644 --- a/back/src/org/kar/karusic/model/Album.java +++ b/back/src/org/kar/karusic/model/Album.java @@ -1,18 +1,6 @@ package org.kar.karusic.model; -/* -CREATE TABLE `node` ( - `id` bigint NOT NULL COMMENT 'table ID' AUTO_INCREMENT PRIMARY KEY, - `deleted` BOOLEAN NOT NULL DEFAULT false, - `create_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been created', - `modify_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been update', - `type` enum("TYPE", "UNIVERS", "SERIE", "SAISON", "MEDIA") NOT NULL DEFAULT 'TYPE', - `name` TEXT COLLATE 'utf8_general_ci' NOT NULL, - `description` TEXT COLLATE 'utf8_general_ci', - `parent_id` bigint -) AUTO_INCREMENT=10; -*/ -import java.sql.Date; +import java.time.LocalDate; import org.kar.archidata.annotation.DataIfNotExists; @@ -24,5 +12,5 @@ import jakarta.persistence.Table; @DataIfNotExists @JsonInclude(JsonInclude.Include.NON_NULL) public class Album extends NodeSmall { - public Date publication = null; + public LocalDate publication = null; } diff --git a/back/src/org/kar/karusic/model/Artist.java b/back/src/org/kar/karusic/model/Artist.java index 4e9df83..2f15146 100644 --- a/back/src/org/kar/karusic/model/Artist.java +++ b/back/src/org/kar/karusic/model/Artist.java @@ -1,18 +1,6 @@ package org.kar.karusic.model; -/* -CREATE TABLE `node` ( - `id` bigint NOT NULL COMMENT 'table ID' AUTO_INCREMENT PRIMARY KEY, - `deleted` BOOLEAN NOT NULL DEFAULT false, - `create_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been created', - `modify_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been update', - `type` enum("TYPE", "UNIVERS", "SERIE", "SAISON", "MEDIA") NOT NULL DEFAULT 'TYPE', - `name` TEXT COLLATE 'utf8_general_ci' NOT NULL, - `description` TEXT COLLATE 'utf8_general_ci', - `parent_id` bigint -) AUTO_INCREMENT=10; -*/ -import java.sql.Date; +import java.time.LocalDate; import org.kar.archidata.annotation.DataIfNotExists; @@ -29,8 +17,8 @@ public class Artist extends NodeSmall { public String firstName = null; @Column(length = 256) public String surname = null; - public Date birth = null; - public Date death = null; + public LocalDate birth = null; + public LocalDate death = null; @Override public String toString() { diff --git a/back/src/org/kar/karusic/model/NodeSmall.java b/back/src/org/kar/karusic/model/NodeSmall.java index ccf3828..06c968e 100644 --- a/back/src/org/kar/karusic/model/NodeSmall.java +++ b/back/src/org/kar/karusic/model/NodeSmall.java @@ -27,6 +27,7 @@ import jakarta.persistence.ManyToMany; public class NodeSmall extends GenericDataSoftDelete { @Column(length = 256) public String name = null; + @Column(length = 0) public String description = null; @ManyToMany(fetch = FetchType.LAZY, targetEntity = Data.class) public List covers = null; diff --git a/back/src/org/kar/karusic/model/Track.java b/back/src/org/kar/karusic/model/Track.java index b8a77bc..7fe6481 100644 --- a/back/src/org/kar/karusic/model/Track.java +++ b/back/src/org/kar/karusic/model/Track.java @@ -15,11 +15,11 @@ CREATE TABLE `node` ( import java.util.List; import org.kar.archidata.annotation.DataIfNotExists; +import org.kar.archidata.annotation.addOn.SQLTableExternalForeinKeyAsList; import com.fasterxml.jackson.annotation.JsonInclude; -import jakarta.persistence.FetchType; -import jakarta.persistence.ManyToMany; +import jakarta.persistence.Column; import jakarta.persistence.Table; @Table(name = "track") @@ -30,9 +30,11 @@ public class Track extends NodeSmall { public Long albumId = null; public Long track = null; public Long dataId = null; - @ManyToMany(fetch = FetchType.LAZY, targetEntity = Artist.class) + //@ManyToMany(fetch = FetchType.LAZY, targetEntity = Artist.class) + @SQLTableExternalForeinKeyAsList + @Column(length = 0) public List artists = null; - + @Override public String toString() { return "Track [id=" + this.id + ", deleted=" + this.deleted + ", createdAt=" + this.createdAt + ", updatedAt=" + this.updatedAt + ", name=" + this.name + ", description=" + this.description diff --git a/back/test/src/test/kar/karusic/TestBase.java b/back/test/src/test/kar/karusic/TestBase.java index 0d9d78f..78a634e 100644 --- a/back/test/src/test/kar/karusic/TestBase.java +++ b/back/test/src/test/kar/karusic/TestBase.java @@ -12,9 +12,9 @@ import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.extension.ExtendWith; import org.kar.archidata.exception.RESTErrorResponseExeption; import org.kar.archidata.model.GetToken; -import org.kar.archidata.util.ConfigBaseVariable; -import org.kar.archidata.util.JWTWrapper; -import org.kar.archidata.util.RESTApi; +import org.kar.archidata.tools.ConfigBaseVariable; +import org.kar.archidata.tools.JWTWrapper; +import org.kar.archidata.tools.RESTApi; import org.kar.karusic.api.HealthCheck.HealthResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/back/test/src/test/kar/karusic/WebLauncherTest.java b/back/test/src/test/kar/karusic/WebLauncherTest.java index 53f21d0..bb0eb6f 100755 --- a/back/test/src/test/kar/karusic/WebLauncherTest.java +++ b/back/test/src/test/kar/karusic/WebLauncherTest.java @@ -1,7 +1,7 @@ package test.kar.karusic; -import org.kar.archidata.util.ConfigBaseVariable; +import org.kar.archidata.tools.ConfigBaseVariable; import org.kar.karusic.WebLauncher; import org.slf4j.Logger; import org.slf4j.LoggerFactory;