[DEV] update new model
This commit is contained in:
parent
154c825499
commit
95c3c0f968
@ -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<UUID> covers = null;
|
||||
}
|
||||
|
@ -1,5 +1,2 @@
|
||||
import { Media, isMedia } from "./media";
|
||||
|
||||
export {
|
||||
Media, isMedia,
|
||||
}
|
||||
export * from "./server-karideo-api.ts";
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user