finamaze_schema 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finamaze_schema",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "A package to connect two APIs with a single SQL database using TypeORM",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,14 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
2
+ import { User } from './user.entity';
3
+
4
+ @Entity()
5
+ export class Email {
6
+ @PrimaryGeneratedColumn()
7
+ id: number;
8
+
9
+ @Column()
10
+ address: string;
11
+
12
+ @ManyToOne(() => User, (user) => user.emails)
13
+ user: User;
14
+ }
@@ -0,0 +1,14 @@
1
+ import { User } from './user.entity';
2
+ import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
3
+
4
+ @Entity()
5
+ export class PhoneNumber {
6
+ @PrimaryGeneratedColumn()
7
+ id: number;
8
+
9
+ @Column({ nullable: false })
10
+ number: string;
11
+
12
+ @ManyToOne(() => User, (user) => user.phone_numbers)
13
+ user: User;
14
+ }
@@ -1,4 +1,6 @@
1
- import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, Unique } from 'typeorm';
1
+ import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, Unique, OneToMany } from 'typeorm';
2
+ import { PhoneNumber } from './phone-number.entity';
3
+ import { Email } from './email.entity';
2
4
 
3
5
  @Entity()
4
6
  @Unique(['username'])
@@ -12,11 +14,17 @@ export class User {
12
14
  @Column({ nullable: true })
13
15
  email: string;
14
16
 
17
+ @OneToMany(() => Email, (email) => email.user, { cascade: true })
18
+ emails: Email[];
19
+
15
20
  @Column({ nullable: true })
16
21
  password: string;
17
22
 
18
23
  @Column({ nullable: true })
19
24
  phone_number: string;
25
+
26
+ @OneToMany(() => PhoneNumber, (phoneNumber) => phoneNumber.user, { cascade: true })
27
+ phone_numbers: PhoneNumber[];
20
28
 
21
29
  @Column({ nullable: true })
22
30
  iqama_number: string;
@@ -48,6 +56,10 @@ export class User {
48
56
  @Column({default: false})
49
57
  is_username_set: boolean;
50
58
 
59
+
60
+ @Column({nullable: true })
61
+ external_status: string;
62
+
51
63
  // Automatically set on entity creation
52
64
  @CreateDateColumn()
53
65
  created_at: Date;
@@ -55,5 +67,4 @@ export class User {
55
67
  // Automatically updated when entity is updated
56
68
  @UpdateDateColumn()
57
69
  updated_at: Date;
58
-
59
70
  }