This commit is contained in:
fro1991
2025-08-04 17:14:14 +07:00
parent d3cd415d24
commit 75381e75ef
5 changed files with 222 additions and 0 deletions

View File

@ -0,0 +1,52 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm";
import { Status } from "../types/status";
import { EformLanguage } from "./eform_languages";
import { EformCif } from "./eform_cifs";
import { EformRequest } from "./eform_requests";
@Entity("eform_accounts", { schema: "eforms" })
export class EformAccount {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => EformRequest, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
request: EformRequest;
@ManyToOne(() => EformCif, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
cif: EformCif;
@Column({
nullable: true,
length: 256,
})
name: string;
@Column({
nullable: false,
length: 64,
})
status: Status;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

48
src/entity/eform_cifs.ts Normal file
View File

@ -0,0 +1,48 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm";
import { Status } from "../types/status";
import { EformLanguage } from "./eform_languages";
import { Branch } from "./branchs";
@Entity("eform_cifs", { schema: "eforms" })
export class EformCif {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
length: 256,
})
number: string;
@Column({
nullable: true,
})
generated_at: Date;
@Column({
nullable: false,
length: 64,
})
status: Status;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

View File

@ -0,0 +1,104 @@
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { EformRequestRequestorType, EformRequestSourceType, EformRequestStatusType } from "../types/eform";
import { Branch } from "./branchs";
import { EformAccount } from "./eform_accounts";
import { EformCif } from "./eform_cifs";
@Entity("eform_requests", { schema: "eforms" })
export class EformRequest {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: true,
length: 256,
})
code: string;
@Column({
nullable: false,
length: 64,
})
source: EformRequestSourceType;
@Column({
nullable: true,
length: 4096,
})
name: string;
@Column({
nullable: true,
length: 128,
})
phone: string;
@Column({
nullable: false,
length: 64,
})
requestor_type: EformRequestRequestorType;
@ManyToOne(() => EformAccount, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
account: EformAccount;
@ManyToOne(() => EformCif, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
cif: EformCif;
@Column({
nullable: false,
length: 64,
})
status: EformRequestStatusType;
@Column({ nullable: true })
requested_at: Date;
@Column({ nullable: true, length: 256 })
requested_by: string;
@ManyToOne(() => Branch, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
branch: Branch;
@Column({ nullable: true })
opened_at: Date;
@Column({ nullable: true, length: 256 })
opened_by: string;
@Column({ nullable: true })
processed_at: Date;
@Column({ nullable: true, length: 256 })
processed_by: string;
@Column({ nullable: true })
closed_at: Date;
@Column({ nullable: true, length: 256 })
closed_by: string;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

View File

@ -19,3 +19,4 @@ export * from "../entity/eform_region_munisipos";
export * from "../entity/eform_region_administrativus"; export * from "../entity/eform_region_administrativus";
export * from "../entity/eform_region_aldeias"; export * from "../entity/eform_region_aldeias";
export * from "../entity/eform_region_sucos"; export * from "../entity/eform_region_sucos";
export * from "../entity/eform_requests";

17
src/types/eform.ts Normal file
View File

@ -0,0 +1,17 @@
export enum EformRequestSourceType {
"web" = "web",
"app_brizzi" = "app_brizzi",
}
export enum EformRequestStatusType {
"verify" = "verify",
"open" = "open",
"process" = "process",
"close" = "close",
"reject" = "reject",
}
export enum EformRequestRequestorType {
"wic" = "wic",
"bri" = "bri",
}