tt-entities 0.0.23 → 0.0.25
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/dist/libs/tatayab-entities-library/entities/product.entity.d.ts +2 -0
- package/dist/libs/tatayab-entities-library/entities/product.entity.js +5 -0
- package/dist/libs/tatayab-entities-library/entities/product.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.d.ts +26 -0
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.js +106 -0
- package/dist/libs/tatayab-entities-library/entities/user-address.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/entities/user-favorite.entity.d.ts +9 -0
- package/dist/libs/tatayab-entities-library/entities/user-favorite.entity.js +40 -0
- package/dist/libs/tatayab-entities-library/entities/user-favorite.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/entities/user.entity.d.ts +4 -0
- package/dist/libs/tatayab-entities-library/entities/user.entity.js +10 -0
- package/dist/libs/tatayab-entities-library/entities/user.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/index.d.ts +2 -0
- package/dist/libs/tatayab-entities-library/index.js +9 -1
- package/dist/libs/tatayab-entities-library/index.js.map +1 -1
- package/dist/src/main.js +191 -2
- package/libs/tatayab-entities-library/src/entities/product.entity.ts +4 -0
- package/libs/tatayab-entities-library/src/entities/user-address.entity.ts +79 -0
- package/libs/tatayab-entities-library/src/entities/user-favorite.entity.ts +30 -0
- package/libs/tatayab-entities-library/src/entities/user.entity.ts +9 -0
- package/libs/tatayab-entities-library/src/index.ts +6 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import { ProductTag } from './product-tag.entity';
|
|
|
17
17
|
import { Store } from './store.entity';
|
|
18
18
|
import { Tag } from './tag.entity';
|
|
19
19
|
import { Status } from '../utils/enums/status';
|
|
20
|
+
import { UserFavorite } from './user-favorite.entity';
|
|
20
21
|
|
|
21
22
|
@Table
|
|
22
23
|
export class Product extends Model {
|
|
@@ -84,4 +85,7 @@ export class Product extends Model {
|
|
|
84
85
|
|
|
85
86
|
@BelongsToMany(() => Tag, () => ProductTag)
|
|
86
87
|
declare tags: Tag[];
|
|
88
|
+
|
|
89
|
+
@HasMany(() => UserFavorite)
|
|
90
|
+
declare userFavorites: UserFavorite[];
|
|
87
91
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
Column,
|
|
4
|
+
Model,
|
|
5
|
+
ForeignKey,
|
|
6
|
+
BelongsTo,
|
|
7
|
+
DataType,
|
|
8
|
+
} from 'sequelize-typescript';
|
|
9
|
+
import { User } from './user.entity';
|
|
10
|
+
import { Country } from './country.entity';
|
|
11
|
+
import { Area } from './area.entity';
|
|
12
|
+
|
|
13
|
+
@Table
|
|
14
|
+
export class UserAddress extends Model {
|
|
15
|
+
@ForeignKey(() => User)
|
|
16
|
+
@Column({ allowNull: false })
|
|
17
|
+
declare userId: number;
|
|
18
|
+
|
|
19
|
+
@Column({ allowNull: false })
|
|
20
|
+
declare label: string; // e.g. 'Home', 'Work', 'Other'
|
|
21
|
+
|
|
22
|
+
@Column({ allowNull: false })
|
|
23
|
+
declare fullName: string;
|
|
24
|
+
|
|
25
|
+
@Column({ allowNull: false })
|
|
26
|
+
declare phoneExt: string;
|
|
27
|
+
|
|
28
|
+
@Column({ allowNull: false })
|
|
29
|
+
declare phone: string;
|
|
30
|
+
|
|
31
|
+
@ForeignKey(() => Country)
|
|
32
|
+
@Column({ allowNull: false })
|
|
33
|
+
declare countryId: number;
|
|
34
|
+
|
|
35
|
+
@ForeignKey(() => Area)
|
|
36
|
+
@Column({ allowNull: true })
|
|
37
|
+
declare areaId?: number;
|
|
38
|
+
|
|
39
|
+
@Column({ allowNull: true })
|
|
40
|
+
declare city?: string;
|
|
41
|
+
|
|
42
|
+
@Column({ allowNull: true })
|
|
43
|
+
declare block?: string;
|
|
44
|
+
|
|
45
|
+
@Column({ allowNull: true })
|
|
46
|
+
declare street?: string;
|
|
47
|
+
|
|
48
|
+
@Column({ allowNull: true })
|
|
49
|
+
declare building?: string;
|
|
50
|
+
|
|
51
|
+
@Column({ allowNull: true })
|
|
52
|
+
declare floor?: string;
|
|
53
|
+
|
|
54
|
+
@Column({ allowNull: true })
|
|
55
|
+
declare apartment?: string;
|
|
56
|
+
|
|
57
|
+
@Column({ type: DataType.TEXT, allowNull: true })
|
|
58
|
+
declare additionalInfo?: string;
|
|
59
|
+
|
|
60
|
+
@Column({ type: DataType.DECIMAL(9, 6), allowNull: true })
|
|
61
|
+
declare latitude?: number;
|
|
62
|
+
|
|
63
|
+
@Column({ type: DataType.DECIMAL(9, 6), allowNull: true })
|
|
64
|
+
declare longitude?: number;
|
|
65
|
+
|
|
66
|
+
@Column({ allowNull: false, defaultValue: false })
|
|
67
|
+
declare isDefault: boolean;
|
|
68
|
+
|
|
69
|
+
// ─── Associations ─────────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
@BelongsTo(() => User)
|
|
72
|
+
declare user: User;
|
|
73
|
+
|
|
74
|
+
@BelongsTo(() => Country)
|
|
75
|
+
declare country: Country;
|
|
76
|
+
|
|
77
|
+
@BelongsTo(() => Area)
|
|
78
|
+
declare area?: Area;
|
|
79
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
Column,
|
|
4
|
+
Model,
|
|
5
|
+
ForeignKey,
|
|
6
|
+
BelongsTo,
|
|
7
|
+
} from 'sequelize-typescript';
|
|
8
|
+
import { User } from './user.entity';
|
|
9
|
+
import { Product } from './product.entity';
|
|
10
|
+
|
|
11
|
+
@Table
|
|
12
|
+
export class UserFavorite extends Model {
|
|
13
|
+
@ForeignKey(() => User)
|
|
14
|
+
@Column({ allowNull: false })
|
|
15
|
+
declare userId: number;
|
|
16
|
+
|
|
17
|
+
@ForeignKey(() => Product)
|
|
18
|
+
@Column({ allowNull: false })
|
|
19
|
+
declare productId: number;
|
|
20
|
+
|
|
21
|
+
// ─── Associations ─────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
@BelongsTo(() => User)
|
|
24
|
+
declare user: User;
|
|
25
|
+
|
|
26
|
+
@BelongsTo(() => Product)
|
|
27
|
+
declare product: Product;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -5,11 +5,14 @@ import {
|
|
|
5
5
|
ForeignKey,
|
|
6
6
|
BelongsTo,
|
|
7
7
|
DataType,
|
|
8
|
+
HasMany,
|
|
8
9
|
} from 'sequelize-typescript';
|
|
9
10
|
import { Status } from '../utils/enums/status';
|
|
10
11
|
import { Language } from '../utils/enums/language';
|
|
11
12
|
import { Country } from './country.entity';
|
|
12
13
|
import { Gender } from '../utils/enums/gender';
|
|
14
|
+
import { UserAddress } from './user-address.entity';
|
|
15
|
+
import { UserFavorite } from './user-favorite.entity';
|
|
13
16
|
|
|
14
17
|
@Table
|
|
15
18
|
export class User extends Model {
|
|
@@ -82,4 +85,10 @@ export class User extends Model {
|
|
|
82
85
|
|
|
83
86
|
@BelongsTo(() => Country)
|
|
84
87
|
declare country: Country;
|
|
88
|
+
|
|
89
|
+
@HasMany(() => UserAddress)
|
|
90
|
+
declare addresses: UserAddress[];
|
|
91
|
+
|
|
92
|
+
@HasMany(() => UserFavorite)
|
|
93
|
+
declare favorites: UserFavorite[];
|
|
85
94
|
}
|
|
@@ -8,6 +8,8 @@ import { SysUser } from './entities/sys.user.entity';
|
|
|
8
8
|
import { User } from './entities/user.entity';
|
|
9
9
|
import { UserDevice } from './entities/userDevice.entity';
|
|
10
10
|
import { ApiKey } from './entities/apikey.entity';
|
|
11
|
+
import { UserAddress } from './entities/user-address.entity';
|
|
12
|
+
import { UserFavorite } from './entities/user-favorite.entity';
|
|
11
13
|
|
|
12
14
|
// ─── Catalogue ────────────────────────────────────────────────────────────────
|
|
13
15
|
import { Category } from './entities/category.entity';
|
|
@@ -53,6 +55,8 @@ export { SysRole } from './entities/sys.role.entity';
|
|
|
53
55
|
export { SysUser } from './entities/sys.user.entity';
|
|
54
56
|
export { User } from './entities/user.entity';
|
|
55
57
|
export { UserDevice } from './entities/userDevice.entity';
|
|
58
|
+
export { UserAddress } from './entities/user-address.entity';
|
|
59
|
+
export { UserFavorite } from './entities/user-favorite.entity';
|
|
56
60
|
|
|
57
61
|
// ─── Catalogue ────────────────────────────────────────────────────────────────
|
|
58
62
|
export { Category } from './entities/category.entity';
|
|
@@ -115,6 +119,8 @@ export function getDbModels(): ModelCtor[] {
|
|
|
115
119
|
SysUser,
|
|
116
120
|
User,
|
|
117
121
|
UserDevice,
|
|
122
|
+
UserAddress,
|
|
123
|
+
UserFavorite,
|
|
118
124
|
|
|
119
125
|
// Catalogue
|
|
120
126
|
Category,
|