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