ConceptPortal-public/rsconcept/frontend/src/models/library.ts

63 lines
1.3 KiB
TypeScript
Raw Normal View History

/**
* Module: Models for LibraryItem.
*/
2023-09-11 20:31:54 +03:00
/**
* Represents type of library items.
2023-12-28 14:04:44 +03:00
*/
2023-09-11 20:31:54 +03:00
export enum LibraryItemType {
RSFORM = 'rsform',
OPERATIONS_SCHEMA = 'oss'
}
/**
* Represents library item version information.
*/
export interface IVersionInfo {
id: number;
version: string;
description: string;
time_create: string;
}
2024-03-17 19:24:12 +03:00
/**
* Represents {@link LibraryItem} identifier type.
*/
export type LibraryItemID = number;
2024-03-04 19:22:22 +03:00
/**
* Represents user data, intended to create or update version metadata in persistent storage.
*/
export interface IVersionData extends Omit<IVersionInfo, 'id' | 'time_create'> {}
/**
* Represents library item common data typical for all item types.
2023-12-28 14:04:44 +03:00
*/
2023-09-11 20:31:54 +03:00
export interface ILibraryItem {
2024-03-17 19:24:12 +03:00
id: LibraryItemID;
2023-12-28 14:04:44 +03:00
item_type: LibraryItemType;
title: string;
alias: string;
comment: string;
is_common: boolean;
is_canonical: boolean;
time_create: string;
time_update: string;
owner: number | null;
2023-09-11 20:31:54 +03:00
}
2023-11-30 02:14:24 +03:00
/**
* Represents library item extended data.
2023-12-28 14:04:44 +03:00
*/
export interface ILibraryItemEx extends ILibraryItem {
subscribers: number[];
2024-05-24 15:40:28 +03:00
editors: number[];
version?: number;
versions: IVersionInfo[];
2023-11-30 02:14:24 +03:00
}
/**
* Represents update data for editing {@link ILibraryItem}.
2023-12-28 14:04:44 +03:00
*/
export interface ILibraryUpdateData extends Omit<ILibraryItem, 'time_create' | 'time_update' | 'id' | 'owner'> {}