update entity
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
"name": "entity",
|
||||
"version": "1.0.0",
|
||||
"description": "This kind of project was built to present entity table type ORM",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"dev": "nodemon",
|
||||
"build": "tsc"
|
||||
|
||||
39
src/entity/administrativu.ts
Normal file
39
src/entity/administrativu.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('administrativus')
|
||||
export class Administrativu {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
39
src/entity/aldeia.ts
Normal file
39
src/entity/aldeia.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('aldeias')
|
||||
export class Aldeia {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
39
src/entity/class_economi.ts
Normal file
39
src/entity/class_economi.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('class_economis')
|
||||
export class ClassEconomi {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
39
src/entity/district.ts
Normal file
39
src/entity/district.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('districts')
|
||||
export class District {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
39
src/entity/income_tier.ts
Normal file
39
src/entity/income_tier.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('income_tiers')
|
||||
export class IncomeTier {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
63
src/entity/menu.ts
Normal file
63
src/entity/menu.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('menus')
|
||||
export class Menu {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
module: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 256
|
||||
})
|
||||
link: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: 'uuid'
|
||||
})
|
||||
id_parent: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: 'int2'
|
||||
})
|
||||
order: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 128
|
||||
})
|
||||
icon: 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;
|
||||
}
|
||||
39
src/entity/munisipo.ts
Normal file
39
src/entity/munisipo.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('munisipos')
|
||||
export class Munisipo {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
39
src/entity/suco.ts
Normal file
39
src/entity/suco.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
|
||||
@Entity('sucos')
|
||||
export class Suco {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 32
|
||||
})
|
||||
code: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 128
|
||||
})
|
||||
name: 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;
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index } from 'typeorm';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn } from 'typeorm';
|
||||
|
||||
import { Status } from '../types/status';
|
||||
import { UserRole } from './users_roles';
|
||||
|
||||
@Entity('users')
|
||||
export class User {
|
||||
@ -48,6 +49,12 @@ export class User {
|
||||
})
|
||||
reset_token: string;
|
||||
|
||||
@OneToOne(() => UserRole)
|
||||
@JoinColumn({
|
||||
name: 'id_role'
|
||||
})
|
||||
role: UserRole;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
length: 64
|
||||
|
||||
@ -13,6 +13,7 @@ import { Status } from "./types/status";
|
||||
import { EmailBody } from "./types/email";
|
||||
import { Branch } from "./entity/branchs";
|
||||
import { Product } from "./entity/products";
|
||||
import { Menu } from "./entity/menu";
|
||||
|
||||
export {
|
||||
User,
|
||||
@ -30,5 +31,6 @@ export {
|
||||
Status,
|
||||
EmailBody,
|
||||
Product,
|
||||
Branch
|
||||
Branch,
|
||||
Menu
|
||||
};
|
||||
@ -16,9 +16,9 @@
|
||||
"typeRoots": ["./src/types", "./node_modules/@types"],
|
||||
// "baseUrl": "src/",
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
// "allowJs": true,
|
||||
"declaration": true
|
||||
// "declaration": true
|
||||
// "emitDeclarationOnly": true,
|
||||
// "declarationMap": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user