add new domains

This commit is contained in:
NCanggoro 2023-10-03 14:38:36 +07:00
parent f4f5799590
commit 9fb697f4ef
6 changed files with 82 additions and 14 deletions

13
src/domains/Province.ts Normal file
View File

@ -0,0 +1,13 @@
export type Province = {
id: number,
province_name: string,
region_id: number
}
export function emptyProvince(): Province {
return {
id: 0,
province_name: '',
region_id: 0
}
}

13
src/domains/Regency.ts Normal file
View File

@ -0,0 +1,13 @@
export type Regency = {
id: number,
regency_name: string,
province_id: number
}
export function emptyRegency(): Regency {
return {
id: 0,
province_id: 0,
regency_name: ''
}
}

4
src/domains/Region.ts Normal file
View File

@ -0,0 +1,4 @@
export type Region = {
id: number,
region_name: string
}

34
src/domains/User.ts Normal file
View File

@ -0,0 +1,34 @@
import { NullValueRes } from "../types/common";
export type User = {
id: number,
email: string,
username: string,
avatar_picture: string,
banned_at: NullValueRes<"Time", string>,
banned_until: NullValueRes<"Time", string>,
ban_reason: string,
is_permaban: boolean,
is_admin: boolean,
is_critics: boolean,
is_verfied: boolean,
social_media: NullValueRes<"RawMessage", any>
}
export function emptyUser(): User {
return {
avatar_picture: '',
ban_reason: '',
banned_at: { Time: '', Valid: false},
banned_until: { Time: '', Valid: false},
email: '',
id: 0,
is_admin: false,
is_critics: false,
is_permaban: false,
is_verfied: false,
social_media: {RawMessage: '', Valid: false},
username: ''
}
}

18
src/domains/index.ts Normal file
View File

@ -0,0 +1,18 @@
import { LocationInfo } from "./LocationInfo"
import { Province, emptyProvince } from "./Province"
import { Regency, emptyRegency } from "./Regency"
import { User } from './User';
import { Region } from "./Region"
export type {
LocationInfo,
Province,
Regency,
Region,
User,
}
export {
emptyProvince,
emptyRegency
}

View File

@ -1,14 +0,0 @@
export interface IUser {
id: Number,
email: String,
username: String,
avatar_picture: String,
banned_at: NullValueRes<"Time", String>,
banned_until: NullValueRes<"Time", String>,
ban_reason: String,
is_permaban: boolean,
is_admin: boolean,
is_critics: boolean,
is_verfied: boolean,
social_media: NullValueRes<"RawMessage", any>
}