diff --git a/back/src/org/kar/karideo/model/Media.java b/back/src/org/kar/karideo/model/Media.java index 11107ed..2a35fc5 100644 --- a/back/src/org/kar/karideo/model/Media.java +++ b/back/src/org/kar/karideo/model/Media.java @@ -18,8 +18,6 @@ import jakarta.persistence.Table; @Entity @Table(name = "media") @JsonInclude(JsonInclude.Include.NON_NULL) -//@SQLDelete(sql = "UPDATE table_product SET deleted = true WHERE id=?") -//@Where(clause = "deleted=false") public class Media extends GenericDataSoftDelete { // Name of the media (this represent the title) @Column(nullable = false, length = 0) @@ -49,6 +47,6 @@ public class Media extends GenericDataSoftDelete { // Limitation Age of the media public Integer ageLimit; // List of Id of the specific covers - @DataJson() + @DataJson(targetEntity = Data.class) public List covers = null; } diff --git a/front/src/app/model/index.ts b/front/src/app/model/index.ts index 2007558..b76f59c 100644 --- a/front/src/app/model/index.ts +++ b/front/src/app/model/index.ts @@ -1,5 +1,2 @@ -import { Media, isMedia } from "./media"; -export { - Media, isMedia, -} \ No newline at end of file +export * from "./server-karideo-api.ts"; diff --git a/front/src/app/model/media.ts b/front/src/app/model/media.ts deleted file mode 100644 index 483c13a..0000000 --- a/front/src/app/model/media.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { isNumberFinite, isString, isOptionalOf } from "common/utils"; -import { isNodeData, NodeData } from "common/model/node"; - - -export interface Media extends NodeData { - dataId?: number; - typeId?: number; - seriesId?: number; - seasonId?: number; - episode?: number; - date?: number; - time?: number; - ageLimit?: number; -}; - - - -export function isMedia(data: any): data is Media { - if (!isNodeData(data) as any) { - return false; - } - if (!isOptionalOf(data.dataId, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.typeId, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.seriesId, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.seasonId, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.episode, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.date, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.time, isNumberFinite)) { - return false; - } - if (!isOptionalOf(data.ageLimit, isNumberFinite)) { - return false; - } - return true; -} diff --git a/front/src/app/model/user-media-advancement.ts b/front/src/app/model/user-media-advancement.ts deleted file mode 100644 index 6a4efd3..0000000 --- a/front/src/app/model/user-media-advancement.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { isNumberFinite, isNumber } from "common/utils"; - - -export interface UserMediaAdvancement { - id: number; - // Id of the media - mediaId?: number; - // Percent of advancement in the media - percent?: number; - // "Number of second of advancement in the media - time?: number; - // Number of time this media has been read - count?: number; -}; - - - -export function isUserMediaAdvancement(data: any): data is UserMediaAdvancement { - if (!isNumberFinite(data.id)) { - return false; - } - if (!isNumberFinite(data.mediaId)) { - return false; - } - if (!isNumber(data.percent)) { - return false; - } - if (!isNumberFinite(data.time)) { - return false; - } - if (!isNumberFinite(data.count)) { - return false; - } - return true; -}