upate briva
This commit is contained in:
68
src/entity/briva_accounts.ts
Normal file
68
src/entity/briva_accounts.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
import { BrivaCompany } from './briva_companies';
|
||||
|
||||
@Entity('briva_accounts', { schema: 'brivas' })
|
||||
export class BrivaAccount {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 256
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 256
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 256
|
||||
})
|
||||
account_number: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 256
|
||||
})
|
||||
account_holder: string;
|
||||
|
||||
@ManyToOne(() => BrivaCompany, { onDelete: 'CASCADE', nullable: true })
|
||||
@JoinTable()
|
||||
company: BrivaCompany
|
||||
|
||||
@Column({
|
||||
nullable: true
|
||||
})
|
||||
last_trans_at: Date;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 256
|
||||
})
|
||||
last_trans_ref_number: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: 'float8'
|
||||
})
|
||||
last_trans_amount: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
73
src/entity/briva_companies.ts
Normal file
73
src/entity/briva_companies.ts
Normal file
@ -0,0 +1,73 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('briva_companies', { schema: 'brivas' })
|
||||
export class BrivaCompany {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 256
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 256
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 4096
|
||||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 64
|
||||
})
|
||||
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()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
64
src/entity/briva_company_user_refresh_token.ts
Normal file
64
src/entity/briva_company_user_refresh_token.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
@Entity('briva_company_user_refresh_tokens', { schema: 'brivas' })
|
||||
export class BrivaCompanyUserRefreshToken {
|
||||
@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/briva_company_users.ts
Normal file
77
src/entity/briva_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 { BrivaCompany } from './briva_companies';
|
||||
|
||||
@Entity('briva_company_users', { schema: 'brivas' })
|
||||
export class BrivaCompanyUser {
|
||||
@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(() => BrivaCompany, { onDelete: 'CASCADE' })
|
||||
@JoinTable()
|
||||
company: BrivaCompany
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
67
src/entity/briva_transactions.ts
Normal file
67
src/entity/briva_transactions.ts
Normal file
@ -0,0 +1,67 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
import { BrivaCompany } from './briva_companies';
|
||||
import { BrivaAccount } from './briva_accounts';
|
||||
import { Branch } from './branchs';
|
||||
|
||||
@Entity('briva_transactions', { schema: 'brivas' })
|
||||
export class BrivaTransaction {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
position_datetime: Date;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 64
|
||||
})
|
||||
reference_number: string;
|
||||
|
||||
@ManyToOne(() => Branch, { onDelete: "RESTRICT" })
|
||||
@JoinColumn()
|
||||
branch: Branch
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 10
|
||||
})
|
||||
teller_code: string;
|
||||
|
||||
@ManyToOne(() => BrivaAccount, { onDelete: 'CASCADE' })
|
||||
@JoinTable()
|
||||
account: BrivaAccount
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
amount: number;
|
||||
|
||||
@Column({
|
||||
length: 3,
|
||||
nullable: true,
|
||||
})
|
||||
currency: string;
|
||||
|
||||
@Column({
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
supervisor: string;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
10
src/index.ts
10
src/index.ts
@ -72,6 +72,11 @@ import { FinanceMemo } from "./entity/finance_memo";
|
||||
import { TellerMutation } from "./entity/teller_mutation";
|
||||
import { LogHikvision } from "./entity/log_hikvision";
|
||||
import { CreditConfigs } from "./entity/credit_config";
|
||||
import { BrivaCompany } from "./entity/briva_companies"
|
||||
import { BrivaCompanyUser } from "./entity/briva_company_users"
|
||||
import { BrivaCompanyUserRefreshToken } from "./entity/briva_company_user_refresh_token"
|
||||
import { BrivaAccount } from './entity/briva_accounts'
|
||||
import { BrivaTransaction } from './entity/briva_transactions'
|
||||
|
||||
export {
|
||||
User, //
|
||||
@ -155,4 +160,9 @@ export {
|
||||
TellerMutation,
|
||||
LogHikvision,
|
||||
CreditConfigs,
|
||||
BrivaCompany,
|
||||
BrivaCompanyUser,
|
||||
BrivaCompanyUserRefreshToken,
|
||||
BrivaAccount,
|
||||
BrivaTransaction
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user