mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
142 lines
2.7 KiB
TypeScript
142 lines
2.7 KiB
TypeScript
![]() |
// Current user info
|
|||
|
export interface ICurrentUser {
|
|||
|
id: number
|
|||
|
username: string
|
|||
|
is_staff: boolean
|
|||
|
}
|
|||
|
|
|||
|
// User profile data
|
|||
|
export interface IUserProfile {
|
|||
|
id: number
|
|||
|
username: string
|
|||
|
email: string
|
|||
|
first_name: string
|
|||
|
last_name: string
|
|||
|
}
|
|||
|
|
|||
|
// User base info
|
|||
|
export interface IUserInfo {
|
|||
|
id: number
|
|||
|
username: string
|
|||
|
first_name: string
|
|||
|
last_name: string
|
|||
|
}
|
|||
|
|
|||
|
// User data for signup
|
|||
|
export interface IUserSignupData {
|
|||
|
username: string
|
|||
|
email: string
|
|||
|
first_name: string
|
|||
|
last_name: string
|
|||
|
password: string
|
|||
|
password2: string
|
|||
|
}
|
|||
|
|
|||
|
// Constituenta type
|
|||
|
export enum CstType {
|
|||
|
BASE = 'basic',
|
|||
|
CONSTANT = 'constant',
|
|||
|
STRUCTURED = 'structure',
|
|||
|
AXIOM = 'axiom',
|
|||
|
TERM = 'term',
|
|||
|
FUNCTION = 'function',
|
|||
|
PREDICATE = 'predicate',
|
|||
|
THEOREM = 'theorem'
|
|||
|
}
|
|||
|
|
|||
|
// ValueClass
|
|||
|
export enum ValueClass {
|
|||
|
INVALID = 'invalid',
|
|||
|
VALUE = 'value',
|
|||
|
PROPERTY = 'property'
|
|||
|
}
|
|||
|
|
|||
|
// Syntax
|
|||
|
export enum Syntax {
|
|||
|
UNDEF = 'undefined',
|
|||
|
ASCII = 'ascii',
|
|||
|
MATH = 'math'
|
|||
|
}
|
|||
|
|
|||
|
// ParsingStatus
|
|||
|
export enum ParsingStatus {
|
|||
|
UNDEF = 'undefined',
|
|||
|
VERIFIED = 'verified',
|
|||
|
INCORRECT = 'incorrect'
|
|||
|
}
|
|||
|
|
|||
|
// Constituenta data
|
|||
|
export interface IConstituenta {
|
|||
|
entityUID: number
|
|||
|
alias: boolean
|
|||
|
cstType: CstType
|
|||
|
convention?: string
|
|||
|
term?: {
|
|||
|
raw: string
|
|||
|
resolved?: string
|
|||
|
}
|
|||
|
definition?: {
|
|||
|
formal: string
|
|||
|
text: {
|
|||
|
raw: string
|
|||
|
resolved?: string
|
|||
|
}
|
|||
|
}
|
|||
|
parse?: {
|
|||
|
status: string
|
|||
|
valueClass: ValueClass
|
|||
|
typification: string
|
|||
|
syntaxTree: string
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// RSForm data
|
|||
|
export interface IRSForm {
|
|||
|
id: number
|
|||
|
title: string
|
|||
|
alias: string
|
|||
|
comment: string
|
|||
|
is_common: boolean
|
|||
|
time_create: string
|
|||
|
time_update: string
|
|||
|
owner?: number
|
|||
|
items?: IConstituenta[]
|
|||
|
}
|
|||
|
|
|||
|
// RSForm data
|
|||
|
export interface IRSFormCreateData {
|
|||
|
title: string
|
|||
|
alias: string
|
|||
|
comment: string
|
|||
|
is_common: boolean
|
|||
|
file?: File
|
|||
|
}
|
|||
|
|
|||
|
export function GetTypeLabel(cst: IConstituenta) {
|
|||
|
if (cst.parse?.typification) {
|
|||
|
return cst.parse.typification;
|
|||
|
}
|
|||
|
if (cst.parse?.status !== ParsingStatus.VERIFIED) {
|
|||
|
return 'N/A';
|
|||
|
}
|
|||
|
return 'Логический';
|
|||
|
}
|
|||
|
|
|||
|
export function GetErrLabel(cst: IConstituenta) {
|
|||
|
if (!cst.parse?.status) {
|
|||
|
return 'N/A';
|
|||
|
}
|
|||
|
if (cst.parse?.status === ParsingStatus.UNDEF) {
|
|||
|
return 'неизв';
|
|||
|
}
|
|||
|
if (cst.parse?.status === ParsingStatus.INCORRECT) {
|
|||
|
return 'ошибка';
|
|||
|
}
|
|||
|
if (cst.parse?.valueClass === ValueClass.INVALID) {
|
|||
|
return 'невыч';
|
|||
|
}
|
|||
|
if (cst.parse?.valueClass === ValueClass.PROPERTY) {
|
|||
|
return 'св-во';
|
|||
|
}
|
|||
|
return 'ОК';
|
|||
|
}
|