initial
This commit is contained in:
149
src/entity/cif_account.ts
Normal file
149
src/entity/cif_account.ts
Normal file
@ -0,0 +1,149 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
@Entity('cif_account')
|
||||
export class CifAccount {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 12
|
||||
})
|
||||
cif_number: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 20
|
||||
})
|
||||
account_number: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 4
|
||||
})
|
||||
branch_code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
open_date: Date;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
product_type: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 256
|
||||
})
|
||||
product_description: string;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
current_balance: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 2
|
||||
})
|
||||
country_code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
country_name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 1
|
||||
})
|
||||
exposed_person_flag: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 1
|
||||
})
|
||||
income_tiering: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 1
|
||||
})
|
||||
cif_type: string;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
status: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 1
|
||||
})
|
||||
gender: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
birth_date: Date;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: false,
|
||||
})
|
||||
economic_sub_clasification: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
})
|
||||
district: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
})
|
||||
munisipiu: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
})
|
||||
administrativu: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
})
|
||||
suco: string;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
})
|
||||
aldeia: string;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
113
src/entity/lnkolek.ts
Normal file
113
src/entity/lnkolek.ts
Normal file
@ -0,0 +1,113 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
@Entity('lnkolek')
|
||||
export class LNKOLEK {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: 'float',
|
||||
nullable: false
|
||||
})
|
||||
rate: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
cif: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
loan_holder_name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
loan_number: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 4
|
||||
})
|
||||
branch_code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
start_date: Date;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
due_date: Date;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
plafon: number;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
balance: number;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
collect: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
collect_date: Date;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
number_of_days_due: number;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
credit_segmentation: number;
|
||||
|
||||
@Column({
|
||||
type: 'int2',
|
||||
nullable: false,
|
||||
})
|
||||
status: number;
|
||||
|
||||
@Column({
|
||||
type: 'float',
|
||||
nullable: false,
|
||||
})
|
||||
ppap_percent: number;
|
||||
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
ppap: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
85
src/entity/trial_balance.ts
Normal file
85
src/entity/trial_balance.ts
Normal file
@ -0,0 +1,85 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
@Entity('trial_balance')
|
||||
export class TrialBalance {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
unique: true,
|
||||
nullable: false,
|
||||
length: 64
|
||||
})
|
||||
ledger: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 256
|
||||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
type: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 1
|
||||
})
|
||||
dc: string;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
initial_balance: number;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
debet_transaction: number;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
credit_transaction: number;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
closing_balance: number;
|
||||
|
||||
@Column({
|
||||
type: 'float8',
|
||||
nullable: false,
|
||||
})
|
||||
closing_balance_eq: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 3
|
||||
})
|
||||
currency: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
position_date: Date;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
64
src/entity/user_activity.ts
Normal file
64
src/entity/user_activity.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { ActivityType } from '../types/action';
|
||||
|
||||
@Entity('user_activities')
|
||||
export class UserActivity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
type: 'uuid'
|
||||
})
|
||||
id_user: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
type: 'uuid'
|
||||
})
|
||||
refresh_token: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 512
|
||||
})
|
||||
module: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 2048
|
||||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 1
|
||||
})
|
||||
action: ActivityType;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 2048,
|
||||
})
|
||||
url: String;
|
||||
|
||||
@Column({
|
||||
type: 'text',
|
||||
nullable: true,
|
||||
})
|
||||
data_body: String;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
64
src/entity/user_refresh_token.ts
Normal file
64
src/entity/user_refresh_token.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
@Entity('user_refresh_tokens')
|
||||
export class UserRefreshToken {
|
||||
@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;
|
||||
}
|
||||
76
src/entity/users.ts
Normal file
76
src/entity/users.ts
Normal file
@ -0,0 +1,76 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('users')
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 64
|
||||
})
|
||||
email: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 64,
|
||||
select: false
|
||||
})
|
||||
password: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 64
|
||||
})
|
||||
username: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 64
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'uuid'
|
||||
})
|
||||
id_role: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'uuid'
|
||||
})
|
||||
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);
|
||||
}
|
||||
}
|
||||
41
src/entity/users_roles.ts
Normal file
41
src/entity/users_roles.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
import { RoleList } from '../types/role';
|
||||
|
||||
@Entity('user_roles')
|
||||
export class UserRole {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
length: 128
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: 'jsonb'
|
||||
})
|
||||
roles: RoleList[];
|
||||
|
||||
@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;
|
||||
}
|
||||
9
src/index.ts
Normal file
9
src/index.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { CifAccount } from "./entity/cif_account";
|
||||
import { LNKOLEK } from "./entity/lnkolek";
|
||||
import { TrialBalance } from "./entity/trial_balance";
|
||||
import { UserActivity } from "./entity/user_activity";
|
||||
import { UserRefreshToken } from "./entity/user_refresh_token";
|
||||
import { User } from "./entity/users";
|
||||
import { UserRole } from "./entity/users_roles";
|
||||
|
||||
export { User, UserRole, UserActivity, UserRefreshToken, TrialBalance, LNKOLEK, CifAccount };
|
||||
7
src/types/action.ts
Normal file
7
src/types/action.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export enum ActivityType {
|
||||
"Create" = "C",
|
||||
"View" = "V",
|
||||
"Update" = "U",
|
||||
"Delete" = "D",
|
||||
"Restore" = "T",
|
||||
};
|
||||
3
src/types/error.ts
Normal file
3
src/types/error.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export type ErrorType = 'General' | 'Raw' | 'Validation' | 'Unauthorized';
|
||||
|
||||
export type ErrorValidation = { [key: string]: string };
|
||||
8
src/types/paging.ts
Normal file
8
src/types/paging.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export interface Paging {
|
||||
page: number,
|
||||
limit: number,
|
||||
filter: any,
|
||||
with_deleted: boolean,
|
||||
order_field: string,
|
||||
order_direction: 'ASC' | 'DESC'
|
||||
}
|
||||
23
src/types/role.ts
Normal file
23
src/types/role.ts
Normal file
@ -0,0 +1,23 @@
|
||||
export enum RoleList {
|
||||
"Dashboard" = "dashboard",
|
||||
"Kinerja UKLN" = "ukln",
|
||||
"Dana Pihak Ketiga" = "dpk",
|
||||
"Posisi Outstanding Pinjaman" = "outstanding_loan",
|
||||
"Presentasi NPL" = "npl",
|
||||
"PPAP Amount NPL" = "ppap_amount",
|
||||
"Report Regulator Bulanan" = "regulator_bulanan",
|
||||
"Report Regulator Triwulan" = "regulator_triwulan",
|
||||
"Report Regulator Publikasi" = "regulator_publikasi",
|
||||
"Perhitungan Simulasi Perpajakan Per Bulan" = "pajak_per_bulan",
|
||||
"Perhitungan Simulasi Perpajakan Per Tahun" = "pajak_per_tahun",
|
||||
"Data Nasabah Potensial" = "nasabah_potensial",
|
||||
"Master Data User" = "master_user",
|
||||
"Master Data Product" = "master_product",
|
||||
"Master Data Tier" = "master_tier",
|
||||
"Master Klasifikasi Ekonomi" = "master_klasifikasi_ekonomi",
|
||||
"Master District" = "master_district",
|
||||
"Master Munisipu" = "master_munisipu",
|
||||
"Master Administrativu" = "master_administrativu",
|
||||
"Master Suco" = "master_suco",
|
||||
"Master Aldeia" = "master_aldeia",
|
||||
}
|
||||
4
src/types/status.ts
Normal file
4
src/types/status.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export enum Status {
|
||||
"Active" = "Y",
|
||||
"Not Active" = "N"
|
||||
};
|
||||
Reference in New Issue
Block a user