[DEV] update with new model
This commit is contained in:
parent
ed94562372
commit
dfa245e842
@ -20,13 +20,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.7.3</version>
|
<version>0.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
<version>2.0.9</version>
|
<version>2.0.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>2.16.1</version>
|
||||||
|
</dependency>
|
||||||
<!--
|
<!--
|
||||||
************************************************************
|
************************************************************
|
||||||
** TEST dependency **
|
** TEST dependency **
|
||||||
|
@ -139,7 +139,7 @@ public class MediaResource {
|
|||||||
} 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");
|
LOGGER.info("Data already exist but deleted");
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
DataTools.undelete(data.id);
|
DataTools.undelete(data.uuid);
|
||||||
data.deleted = false;
|
data.deleted = false;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Data already exist ... all good");
|
LOGGER.info("Data already exist ... all good");
|
||||||
@ -179,7 +179,7 @@ public class MediaResource {
|
|||||||
try {
|
try {
|
||||||
final Media media = new Media();
|
final Media media = new Media();
|
||||||
media.name = title;
|
media.name = title;
|
||||||
media.dataId = data.id;
|
media.dataId = data.uuid;
|
||||||
media.typeId = typeNode.id;
|
media.typeId = typeNode.id;
|
||||||
media.seriesId = null;
|
media.seriesId = null;
|
||||||
if (seriesNode != null) {
|
if (seriesNode != null) {
|
||||||
|
@ -27,13 +27,9 @@ public class Initialization extends MigrationSqlStep {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateStep() throws Exception {
|
public void generateStep() throws Exception {
|
||||||
addClass(Data.class);
|
for(final Class<?> clazz : CLASSES_BASE) {
|
||||||
addClass(Media.class);
|
addClass(clazz);
|
||||||
addClass(Type.class);
|
}
|
||||||
addClass(Series.class);
|
|
||||||
addClass(Season.class);
|
|
||||||
addClass(User.class);
|
|
||||||
addClass(UserMediaAdvancement.class);
|
|
||||||
|
|
||||||
addAction("""
|
addAction("""
|
||||||
INSERT INTO `type` (`id`, `name`, `description`) VALUES
|
INSERT INTO `type` (`id`, `name`, `description`) VALUES
|
||||||
|
@ -33,7 +33,6 @@ export namespace DataResource {
|
|||||||
endPoint: "/data//upload/",
|
endPoint: "/data//upload/",
|
||||||
requestType: HTTPRequestModel.POST,
|
requestType: HTTPRequestModel.POST,
|
||||||
contentType: HTTPMimeType.MULTIPART,
|
contentType: HTTPMimeType.MULTIPART,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
data,
|
data,
|
||||||
@ -54,13 +53,13 @@ export namespace DataResource {
|
|||||||
Authorization?: string,
|
Authorization?: string,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/{id}",
|
endPoint: "/data/{uuid}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -84,13 +83,13 @@ export namespace DataResource {
|
|||||||
Authorization?: string,
|
Authorization?: string,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/thumbnail/{id}",
|
endPoint: "/data/thumbnail/{uuid}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -115,13 +114,13 @@ export namespace DataResource {
|
|||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
name: string,
|
name: string,
|
||||||
id: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/{id}/{name}",
|
endPoint: "/data/{uuid}/{name}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
RESTRequestVoid
|
RESTRequestVoid
|
||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
Media,
|
|
||||||
Long,
|
Long,
|
||||||
|
Media,
|
||||||
UUID,
|
UUID,
|
||||||
isMedia,
|
isMedia,
|
||||||
} from "./model"
|
} from "./model"
|
||||||
@ -36,7 +36,6 @@ export namespace MediaResource {
|
|||||||
endPoint: "/media/{id}",
|
endPoint: "/media/{id}",
|
||||||
requestType: HTTPRequestModel.DELETE,
|
requestType: HTTPRequestModel.DELETE,
|
||||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
|
@ -383,7 +383,7 @@ export function isMedia(data: any): data is Media {
|
|||||||
|
|
||||||
export const ZodUUIDGenericData = ZodGenericTiming.extend({
|
export const ZodUUIDGenericData = ZodGenericTiming.extend({
|
||||||
// Unique UUID of the object
|
// Unique UUID of the object
|
||||||
id: ZodUUID.readonly().optional()
|
uuid: ZodUUID.readonly().optional()
|
||||||
});
|
});
|
||||||
export type UUIDGenericData = zod.infer<typeof ZodUUIDGenericData>;
|
export type UUIDGenericData = zod.infer<typeof ZodUUIDGenericData>;
|
||||||
export function isUUIDGenericData(data: any): data is UUIDGenericData {
|
export function isUUIDGenericData(data: any): data is UUIDGenericData {
|
||||||
|
@ -95,6 +95,10 @@ export interface RESTRequestType {
|
|||||||
callback?: RESTCallbacks,
|
callback?: RESTCallbacks,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function replaceAll(input, searchValue, replaceValue) {
|
||||||
|
return input.split(searchValue).join(replaceValue);
|
||||||
|
}
|
||||||
|
|
||||||
function removeTrailingSlashes(input: string): string {
|
function removeTrailingSlashes(input: string): string {
|
||||||
if (isNullOrUndefined(input)) {
|
if (isNullOrUndefined(input)) {
|
||||||
return "undefined";
|
return "undefined";
|
||||||
@ -113,7 +117,7 @@ export function RESTUrl({ restModel, restConfig, params, queries }: RESTRequestT
|
|||||||
let generateUrl = `${removeTrailingSlashes(restConfig.server)}/${removeLeadingSlashes(restModel.endPoint)}`;
|
let generateUrl = `${removeTrailingSlashes(restConfig.server)}/${removeLeadingSlashes(restModel.endPoint)}`;
|
||||||
if (params !== undefined) {
|
if (params !== undefined) {
|
||||||
for (let key of Object.keys(params)) {
|
for (let key of Object.keys(params)) {
|
||||||
generateUrl = generateUrl.replaceAll(`{${key}}`, `${params[key]}`);
|
generateUrl = replaceAll(generateUrl, `{${key}}`, `${params[key]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (queries === undefined && (restConfig.token === undefined || restModel.tokenInUrl !== true)) {
|
if (queries === undefined && (restConfig.token === undefined || restModel.tokenInUrl !== true)) {
|
||||||
@ -199,7 +203,7 @@ export function fetchProgress(generateUrl: string, { method, headers, body }: {
|
|||||||
status: xhr.io.status,
|
status: xhr.io.status,
|
||||||
statusText: xhr.io.statusText
|
statusText: xhr.io.statusText
|
||||||
});
|
});
|
||||||
const headersArray = xhr.io.getAllResponseHeaders().trim().replaceAll("\r\n", "\n").split('\n');
|
const headersArray = replaceAll(xhr.io.getAllResponseHeaders().trim(), "\r\n", "\n").split('\n');
|
||||||
headersArray.forEach(function (header) {
|
headersArray.forEach(function (header) {
|
||||||
const firstColonIndex = header.indexOf(':');
|
const firstColonIndex = header.indexOf(':');
|
||||||
if (firstColonIndex !== -1) {
|
if (firstColonIndex !== -1) {
|
||||||
|
@ -13,8 +13,8 @@ import {
|
|||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
Long,
|
Long,
|
||||||
UUID,
|
|
||||||
Season,
|
Season,
|
||||||
|
UUID,
|
||||||
isSeason,
|
isSeason,
|
||||||
} from "./model"
|
} from "./model"
|
||||||
export namespace SeasonResource {
|
export namespace SeasonResource {
|
||||||
@ -36,7 +36,6 @@ export namespace SeasonResource {
|
|||||||
endPoint: "/season/{id}",
|
endPoint: "/season/{id}",
|
||||||
requestType: HTTPRequestModel.DELETE,
|
requestType: HTTPRequestModel.DELETE,
|
||||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
|
@ -13,8 +13,8 @@ import {
|
|||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
Long,
|
Long,
|
||||||
UUID,
|
|
||||||
Series,
|
Series,
|
||||||
|
UUID,
|
||||||
isSeries,
|
isSeries,
|
||||||
} from "./model"
|
} from "./model"
|
||||||
export namespace SeriesResource {
|
export namespace SeriesResource {
|
||||||
@ -36,7 +36,6 @@ export namespace SeriesResource {
|
|||||||
endPoint: "/series/{id}",
|
endPoint: "/series/{id}",
|
||||||
requestType: HTTPRequestModel.DELETE,
|
requestType: HTTPRequestModel.DELETE,
|
||||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
RESTRequestVoid
|
RESTRequestVoid
|
||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
Type,
|
|
||||||
Long,
|
Long,
|
||||||
|
Type,
|
||||||
UUID,
|
UUID,
|
||||||
isType,
|
isType,
|
||||||
} from "./model"
|
} from "./model"
|
||||||
@ -36,7 +36,6 @@ export namespace TypeResource {
|
|||||||
endPoint: "/type/{id}",
|
endPoint: "/type/{id}",
|
||||||
requestType: HTTPRequestModel.DELETE,
|
requestType: HTTPRequestModel.DELETE,
|
||||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
RESTRequestVoid
|
RESTRequestVoid
|
||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
MediaInformationsDelta,
|
|
||||||
Long,
|
Long,
|
||||||
|
MediaInformationsDelta,
|
||||||
UserMediaAdvancement,
|
UserMediaAdvancement,
|
||||||
isUserMediaAdvancement,
|
isUserMediaAdvancement,
|
||||||
} from "./model"
|
} from "./model"
|
||||||
@ -36,7 +36,6 @@ export namespace UserMediaAdvancementResource {
|
|||||||
endPoint: "/advancement/{id}",
|
endPoint: "/advancement/{id}",
|
||||||
requestType: HTTPRequestModel.DELETE,
|
requestType: HTTPRequestModel.DELETE,
|
||||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||||
accept: HTTPMimeType.JSON,
|
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
RESTRequestVoid
|
RESTRequestVoid
|
||||||
} from "./rest-tools"
|
} from "./rest-tools"
|
||||||
import {
|
import {
|
||||||
UserKarideo,
|
|
||||||
Long,
|
Long,
|
||||||
|
UserKarideo,
|
||||||
UserOut,
|
UserOut,
|
||||||
isUserKarideo,
|
isUserKarideo,
|
||||||
isUserOut,
|
isUserOut,
|
||||||
|
@ -9,15 +9,15 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "ES2022",
|
"target": "ES2018",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"ES2022",
|
"ES2018",
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"module": "ES2022",
|
"module": "ES2020",
|
||||||
"baseUrl": "./src",
|
"baseUrl": "./src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@app/*": [
|
"@app/*": [
|
||||||
@ -36,4 +36,4 @@
|
|||||||
"defer"
|
"defer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user