Files
kotosoft-id/kotosoft-id-frontend/types.ts
T
2026-07-11 19:04:41 +03:00

109 lines
1.9 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;
}
type CitizenshipApplicationStatus = "pending" | "rejected" | "approved"
export interface CitizenshipApplication {
id: string;
user_id: string;
status: CitizenshipApplicationStatus;
region_id: string;
reviewed_by?: string;
reviewed_at?: string;
reject_reason?: string;
created_at: string;
}
export interface Citizen {
id: string;
user_id: string;
application_id: string;
number: string;
issued_at: string;
region_id: string;
}