update
This commit is contained in:
45
src/entity/credit_application_chats.ts
Normal file
45
src/entity/credit_application_chats.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { CreditApplication } from './credit_applications';
|
||||||
|
import { CreditTypeForms } from './credit_type_forms';
|
||||||
|
import { CreditCompanyUser } from './credit_company_users';
|
||||||
|
|
||||||
|
@Entity('credit_application_chats')
|
||||||
|
export class CreditApplicationChat {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => CreditApplication, { onDelete: "RESTRICT" })
|
||||||
|
@JoinColumn()
|
||||||
|
application: CreditApplication
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
company: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
message: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
@ -22,6 +22,12 @@ export class CreditApplicationForm {
|
|||||||
})
|
})
|
||||||
value: string;
|
value: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
status: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToO
|
|||||||
import { CreditApplicationStatus } from '../types/credit';
|
import { CreditApplicationStatus } from '../types/credit';
|
||||||
import { CreditCompany } from './credit_companies';
|
import { CreditCompany } from './credit_companies';
|
||||||
import { CreditDebtor } from './credit_debtors';
|
import { CreditDebtor } from './credit_debtors';
|
||||||
|
import { CreditCompanyUser } from './credit_company_users';
|
||||||
|
|
||||||
@Entity('credit_applications')
|
@Entity('credit_applications')
|
||||||
export class CreditApplication {
|
export class CreditApplication {
|
||||||
@ -17,6 +18,10 @@ export class CreditApplication {
|
|||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
company: CreditCompany
|
company: CreditCompany
|
||||||
|
|
||||||
|
@ManyToOne(() => CreditCompanyUser)
|
||||||
|
@JoinColumn()
|
||||||
|
user: CreditCompanyUser
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 256
|
length: 256
|
||||||
|
|||||||
@ -8,11 +8,19 @@ export class CreditCompany {
|
|||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
length: 256
|
length: 256
|
||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 4096
|
length: 4096
|
||||||
@ -25,6 +33,32 @@ export class CreditCompany {
|
|||||||
})
|
})
|
||||||
status: Status;
|
status: Status;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_phone: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_email: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
|
|||||||
64
src/entity/credit_company_user_refresh_token.ts
Normal file
64
src/entity/credit_company_user_refresh_token.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('credit_company_user_refresh_tokens')
|
||||||
|
export class CreditCompanyUserRefreshToken {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
refresh_token: string;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
type: 'uuid'
|
||||||
|
})
|
||||||
|
id_user: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 4096,
|
||||||
|
})
|
||||||
|
user_agent: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 128
|
||||||
|
})
|
||||||
|
os: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
device: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
platform: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
browser: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 32
|
||||||
|
})
|
||||||
|
remote_addr: string;
|
||||||
|
|
||||||
|
@Column('timestamp')
|
||||||
|
expired_at: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
77
src/entity/credit_company_users.ts
Normal file
77
src/entity/credit_company_users.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import bcrypt from 'bcryptjs';
|
||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { CreditCompany } from './credit_companies';
|
||||||
|
|
||||||
|
@Entity('credit_company_users')
|
||||||
|
export class CreditCompanyUser {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
select: false
|
||||||
|
})
|
||||||
|
password: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
username: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64,
|
||||||
|
unique: false,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => CreditCompany, { onDelete: 'CASCADE' })
|
||||||
|
@JoinTable()
|
||||||
|
company: CreditCompany
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
select: false
|
||||||
|
})
|
||||||
|
reset_token: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
hashPassword() {
|
||||||
|
this.password = bcrypt.hashSync(this.password, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkIfPasswordMatch(unencryptedPassword: string) {
|
||||||
|
return bcrypt.compareSync(unencryptedPassword, this.password);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -46,6 +46,9 @@ import { CreditTypeForms } from "./entity/credit_type_forms";
|
|||||||
import { CreditApplication } from "./entity/credit_applications";
|
import { CreditApplication } from "./entity/credit_applications";
|
||||||
import { CreditApplicationStatus } from "./types/credit";
|
import { CreditApplicationStatus } from "./types/credit";
|
||||||
import { CreditApplicationForm } from "./entity/credit_application_forms";
|
import { CreditApplicationForm } from "./entity/credit_application_forms";
|
||||||
|
import { CreditCompanyUser } from "./entity/credit_company_users";
|
||||||
|
import { CreditCompanyUserRefreshToken } from "./entity/credit_company_user_refresh_token";
|
||||||
|
import { CreditApplicationChat } from "./entity/credit_application_chats";
|
||||||
import { Application } from "./entity/application";
|
import { Application } from "./entity/application";
|
||||||
import { AssetClassification } from "./entity/asset_classification"
|
import { AssetClassification } from "./entity/asset_classification"
|
||||||
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
|
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
|
||||||
@ -65,6 +68,8 @@ import { AssetJournalEntry } from "./entity/journal_entries";
|
|||||||
import { PaymentApproval } from "./entity/payment_approval";
|
import { PaymentApproval } from "./entity/payment_approval";
|
||||||
import { FinanceMemo } from "./entity/finance_memo";
|
import { FinanceMemo } from "./entity/finance_memo";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
User, //
|
User, //
|
||||||
UserRole,
|
UserRole,
|
||||||
@ -136,5 +141,8 @@ export {
|
|||||||
CreditApplication,
|
CreditApplication,
|
||||||
CreditApplicationStatus,
|
CreditApplicationStatus,
|
||||||
CreditApplicationForm,
|
CreditApplicationForm,
|
||||||
|
CreditCompanyUser,
|
||||||
|
CreditCompanyUserRefreshToken,
|
||||||
|
CreditApplicationChat,
|
||||||
Application,
|
Application,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user