[DEV] ready for deply new model of data UUID
This commit is contained in:
parent
f6f9fa199a
commit
e05fe70f80
@ -20,7 +20,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.7.0</version>
|
<version>0.7.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
@ -18,7 +18,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class WebLauncherLocal extends WebLauncher {
|
public class WebLauncherLocal extends WebLauncher {
|
||||||
final Logger logger = LoggerFactory.getLogger(WebLauncherLocal.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WebLauncherLocal.class);
|
||||||
|
|
||||||
private WebLauncherLocal() {}
|
private WebLauncherLocal() {}
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ public class WebLauncherLocal extends WebLauncher {
|
|||||||
Initialization.CLASSES_BASE, "../front/src/app/back-api/");
|
Initialization.CLASSES_BASE, "../front/src/app/back-api/");
|
||||||
final WebLauncherLocal launcher = new WebLauncherLocal();
|
final WebLauncherLocal launcher = new WebLauncherLocal();
|
||||||
launcher.process();
|
launcher.process();
|
||||||
launcher.logger.info("end-configure the server & wait finish process:");
|
launcher.LOGGER.info("end-configure the server & wait finish process:");
|
||||||
Thread.currentThread().join();
|
Thread.currentThread().join();
|
||||||
launcher.logger.info("STOP the REST server:");
|
launcher.LOGGER.info("STOP the REST server:");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,22 @@
|
|||||||
package org.kar.karusic.migration;
|
package org.kar.karusic.migration;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.kar.archidata.api.DataResource;
|
||||||
|
import org.kar.archidata.dataAccess.DataAccess;
|
||||||
|
import org.kar.archidata.dataAccess.addOn.model.LinkTable;
|
||||||
|
import org.kar.archidata.dataAccess.options.AccessDeletedItems;
|
||||||
|
import org.kar.archidata.dataAccess.options.OverrideTableName;
|
||||||
import org.kar.archidata.migration.MigrationSqlStep;
|
import org.kar.archidata.migration.MigrationSqlStep;
|
||||||
|
import org.kar.archidata.tools.UuidUtils;
|
||||||
|
import org.kar.karusic.migration.model.CoverConversion;
|
||||||
|
import org.kar.karusic.migration.model.MediaConversion;
|
||||||
|
import org.kar.karusic.migration.model.UUIDConversion;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -20,15 +36,13 @@ public class Migration20240226 extends MigrationSqlStep {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateStep() throws Exception {
|
public void generateStep() throws Exception {
|
||||||
/*
|
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `data` ADD `uuid` binary(16) AFTER `id`;
|
ALTER TABLE `data` ADD `uuid` binary(16) AFTER `id`;
|
||||||
""");
|
""");
|
||||||
addAction(() -> {
|
addAction(() -> {
|
||||||
final List<UUIDConversion> datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
final List<UUIDConversion> datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
||||||
for (final UUIDConversion elem: datas) {
|
for (final UUIDConversion elem: datas) {
|
||||||
elem.uuid = UUID.randomUUID();
|
elem.uuid = UuidUtils.nextUUID();
|
||||||
//elem.uuid = new UUID(elem.id * (long)Math.pow(2, 32), 0);
|
|
||||||
}
|
}
|
||||||
for (final UUIDConversion elem: datas) {
|
for (final UUIDConversion elem: datas) {
|
||||||
DataAccess.update(elem, elem.id, List.of("uuid"), new OverrideTableName("data"));
|
DataAccess.update(elem, elem.id, List.of("uuid"), new OverrideTableName("data"));
|
||||||
@ -93,10 +107,20 @@ public class Migration20240226 extends MigrationSqlStep {
|
|||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `track` DROP `dataId`;
|
ALTER TABLE `track` DROP `dataId`;
|
||||||
""");
|
""");
|
||||||
*/
|
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `track` CHANGE `dataUUID` `dataId` binary(16) NOT NULL;
|
ALTER TABLE `track` CHANGE `dataUUID` `dataId` binary(16) NOT NULL;
|
||||||
""");
|
""");
|
||||||
|
// Move the files...
|
||||||
|
addAction(() -> {
|
||||||
|
final List<UUIDConversion> datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
||||||
|
for (final UUIDConversion data: datas) {
|
||||||
|
final String origin = DataResource.getFileDataOld(data.id);
|
||||||
|
final String destination = DataResource.getFileData(data.uuid);
|
||||||
|
LOGGER.info("move file = {}", origin);
|
||||||
|
LOGGER.info(" ==> {}", destination);
|
||||||
|
Files.move(Paths.get(origin), Paths.get(destination), StandardCopyOption.ATOMIC_MOVE);
|
||||||
|
}
|
||||||
|
});
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `data` DROP `id`;
|
ALTER TABLE `data` DROP `id`;
|
||||||
""");
|
""");
|
||||||
@ -106,17 +130,6 @@ public class Migration20240226 extends MigrationSqlStep {
|
|||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `data` ADD PRIMARY KEY `id` (`id`);
|
ALTER TABLE `data` ADD PRIMARY KEY `id` (`id`);
|
||||||
""");
|
""");
|
||||||
/*
|
|
||||||
// Move the files...
|
|
||||||
addAction(() -> {
|
|
||||||
final List<UUIDConversion> datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
|
||||||
for (final UUIDConversion data: datas) {
|
|
||||||
|
|
||||||
final String origin = DataResource.getFileData(data.id);
|
|
||||||
final String destination = DataResource.getFileData(data.uuid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,29 +72,6 @@ export namespace TrackResource {
|
|||||||
data,
|
data,
|
||||||
}, isTrack);
|
}, isTrack);
|
||||||
};
|
};
|
||||||
export function uploadTrack({ restConfig, data, }: {
|
|
||||||
restConfig: RESTConfig,
|
|
||||||
data: {
|
|
||||||
fileName: string,
|
|
||||||
file: File,
|
|
||||||
gender: string,
|
|
||||||
artist: string,
|
|
||||||
album: string,
|
|
||||||
trackId: Long,
|
|
||||||
title: string,
|
|
||||||
},
|
|
||||||
}): Promise<Track> {
|
|
||||||
return RESTRequestJson({
|
|
||||||
restModel: {
|
|
||||||
endPoint: "/track/upload/",
|
|
||||||
requestType: HTTPRequestModel.POST,
|
|
||||||
contentType: HTTPMimeType.MULTIPART,
|
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
|
||||||
restConfig,
|
|
||||||
data,
|
|
||||||
}, isTrack);
|
|
||||||
};
|
|
||||||
export function gets({ restConfig, }: {
|
export function gets({ restConfig, }: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
}): Promise<Track[]> {
|
}): Promise<Track[]> {
|
||||||
@ -183,4 +160,27 @@ export namespace TrackResource {
|
|||||||
params,
|
params,
|
||||||
}, isTrack);
|
}, isTrack);
|
||||||
};
|
};
|
||||||
|
export function uploadTrack({ restConfig, data, }: {
|
||||||
|
restConfig: RESTConfig,
|
||||||
|
data: {
|
||||||
|
fileName: string,
|
||||||
|
file: File,
|
||||||
|
gender: string,
|
||||||
|
artist: string,
|
||||||
|
album: string,
|
||||||
|
trackId: Long,
|
||||||
|
title: string,
|
||||||
|
},
|
||||||
|
}): Promise<Track> {
|
||||||
|
return RESTRequestJson({
|
||||||
|
restModel: {
|
||||||
|
endPoint: "/track/upload/",
|
||||||
|
requestType: HTTPRequestModel.POST,
|
||||||
|
contentType: HTTPMimeType.MULTIPART,
|
||||||
|
accept: HTTPMimeType.JSON,
|
||||||
|
},
|
||||||
|
restConfig,
|
||||||
|
data,
|
||||||
|
}, isTrack);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class ElementSeasonComponent implements OnInit {
|
|||||||
this.description = this.element.description;
|
this.description = this.element.description;
|
||||||
console.log(`covers: ${this.element.covers}`);
|
console.log(`covers: ${this.element.covers}`);
|
||||||
this.covers = this.dataService.getListThumbnailUrl(this.element.covers);
|
this.covers = this.dataService.getListThumbnailUrl(this.element.covers);
|
||||||
console.log(`covers >> : ${this.covers}`);
|
console.log(`covers ${this.element.covers} >> : ${this.covers}`);
|
||||||
let self = this;
|
let self = this;
|
||||||
if (!isNullOrUndefined(this.countSubTypeCallBack)) {
|
if (!isNullOrUndefined(this.countSubTypeCallBack)) {
|
||||||
this.countSubTypeCallBack(this.element.id)
|
this.countSubTypeCallBack(this.element.id)
|
||||||
|
@ -36,8 +36,6 @@ export class ArtistsScene implements OnInit {
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.countTrack = (id: number) => { return self.countTrackCallback(id); };
|
this.countTrack = (id: number) => { return self.countTrackCallback(id); };
|
||||||
this.countAlbum = (id: number) => { return self.countAlbumCallback(id); };
|
this.countAlbum = (id: number) => { return self.countAlbumCallback(id); };
|
||||||
// this.idPlaylist = parseInt(this.route.snapshot.paramMap.get('universId'));
|
|
||||||
// this.idType = parseInt(this.route.snapshot.paramMap.get('typeId'));
|
|
||||||
this.artistService.getOrder()
|
this.artistService.getOrder()
|
||||||
.then((response: Artist[]) => {
|
.then((response: Artist[]) => {
|
||||||
self.artists = response;
|
self.artists = response;
|
||||||
|
@ -84,7 +84,9 @@ export class GenericDataService<TYPE> {
|
|||||||
key: 'id',
|
key: 'id',
|
||||||
value: [undefined, null],
|
value: [undefined, null],
|
||||||
},
|
},
|
||||||
]);
|
],
|
||||||
|
["name", "id"],
|
||||||
|
);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch((response) => {
|
}).catch((response) => {
|
||||||
console.log(`[E] ${self.constructor.name}: can not retrieve BDD values`);
|
console.log(`[E] ${self.constructor.name}: can not retrieve BDD values`);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { isArrayOf, isNullOrUndefined, isNumberFinite } from 'common/utils';
|
import { isArrayOf, isNullOrUndefined, isNumberFinite, isString } from 'common/utils';
|
||||||
|
|
||||||
import { SessionService } from 'common/service';
|
import { SessionService } from 'common/service';
|
||||||
import { RESTConfig, RESTUrl } from 'app/back-api/rest-tools';
|
import { RESTConfig, RESTUrl } from 'app/back-api/rest-tools';
|
||||||
@ -65,7 +65,7 @@ export class DataService {
|
|||||||
* @returns the url of the cover
|
* @returns the url of the cover
|
||||||
*/
|
*/
|
||||||
getListUrl(dataIds?: string[]): string[] | undefined {
|
getListUrl(dataIds?: string[]): string[] | undefined {
|
||||||
if (!isArrayOf(dataIds, isNumberFinite) || dataIds.length === 0) {
|
if (!isArrayOf(dataIds, isString) || dataIds.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let covers: string[] = [];
|
let covers: string[] = [];
|
||||||
@ -97,7 +97,7 @@ export class DataService {
|
|||||||
* @returns the url of the cover
|
* @returns the url of the cover
|
||||||
*/
|
*/
|
||||||
getListThumbnailUrl(dataIds?: string[]): string[] | undefined {
|
getListThumbnailUrl(dataIds?: string[]): string[] | undefined {
|
||||||
if (!isArrayOf(dataIds, isNumberFinite) || dataIds.length === 0) {
|
if (!isArrayOf(dataIds, isString) || dataIds.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let covers: string[] = [];
|
let covers: string[] = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user