Files
kotosoft-id/kotosoft-id-frontend/types.ts
T
2026-05-04 11:14:30 +03:00

128 lines
2.3 KiB
TypeScript

import { enUS, it, ru } from "date-fns/locale";
export enum Sex {
MALE = "MALE",
FEMALE = "FEMALE"
}
export interface User {
id: string;
email: string;
first_name: string;
second_name: string;
birth_date: string;
sex: Sex;
is_admin: boolean;
}
export interface OAuthSession {
client_id: string;
client_name: string;
redirect_uri: string;
scopes: string[];
state: string;
user_id?: string;
}
export interface Consent {
client_id: string;
client_name: string;
scopes: string[];
authorized_at: string;
last_used_at: string | null;
isRevokable: boolean;
}
export interface Permission {
id: string;
code: string;
name: string;
description: string;
created_at: string;
}
export interface Position {
code: string;
name: string;
description?: string | null;
permissions: Permission[];
}
export interface AdminUser {
id: string;
email: string;
first_name: string;
second_name: string;
is_admin: boolean;
positions: Position[];
}
export const localeMap = {
ru,
en: enUS,
it,
};
export interface Region {
id: string;
code: string;
name: string;
}
type FieldType = "text" | "date" | "select" | "masked"
export interface FieldOption {
value: string;
label: { en: string; ru: string };
}
export interface FieldTemplate {
id: string;
name: { en: string; ru: string };
type: FieldType;
required?: boolean;
mask?: string;
options?: FieldOption[];
generated?: boolean;
}
export interface DocumentType {
id: string;
code: string;
color: string;
fields: FieldTemplate[];
}
export type DocumentApplicationStatus = "pending" | "approved" | "rejected"
export interface DocumentApplication {
id: string;
userId: string;
documentTypeId: string;
documentType: DocumentType;
status: DocumentApplicationStatus;
reviewedBy?: string;
reviewedAt?: string;
rejectReason?: string;
data: Record<string, string>;
createdAt: string;
updatedAt: string;
}
export type DocumentStatus = "active" | "revoked"
export interface Document {
id: string;
userId: string;
documentTypeId: string;
documentType: DocumentType;
applicationId: string;
number: string;
issuedAt: string;
revokedAt?: string | null;
revokedBy?: string | null;
photo_url?: string | null;
data: Record<string, string>;
createdAt: string;
updatedAt: string;
}