tt-entities 0.0.2 → 0.0.3
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/main.js
CHANGED
|
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
22
22
|
exports.AppModule = void 0;
|
|
23
23
|
const common_1 = __webpack_require__(3);
|
|
24
24
|
const src_1 = __webpack_require__(4);
|
|
25
|
-
const sequelize_1 = __webpack_require__(
|
|
26
|
-
const config_1 = __webpack_require__(
|
|
25
|
+
const sequelize_1 = __webpack_require__(20);
|
|
26
|
+
const config_1 = __webpack_require__(21);
|
|
27
27
|
let AppModule = class AppModule {
|
|
28
28
|
};
|
|
29
29
|
exports.AppModule = AppModule;
|
|
@@ -44,6 +44,10 @@ exports.AppModule = AppModule = __decorate([
|
|
|
44
44
|
synchronize: true,
|
|
45
45
|
logging: false,
|
|
46
46
|
models: (0, src_1.getDbModels)(),
|
|
47
|
+
define: {
|
|
48
|
+
timestamps: true,
|
|
49
|
+
paranoid: true,
|
|
50
|
+
},
|
|
47
51
|
}),
|
|
48
52
|
],
|
|
49
53
|
providers: [],
|
|
@@ -74,8 +78,18 @@ const area_entity_1 = __webpack_require__(13);
|
|
|
74
78
|
const sys_role_entity_1 = __webpack_require__(14);
|
|
75
79
|
const sys_user_entity_1 = __webpack_require__(15);
|
|
76
80
|
const user_entity_1 = __webpack_require__(16);
|
|
81
|
+
const userDevice_entity_1 = __webpack_require__(19);
|
|
77
82
|
function getDbModels() {
|
|
78
|
-
return [
|
|
83
|
+
return [
|
|
84
|
+
apikey_entity_1.default,
|
|
85
|
+
area_entity_1.Area,
|
|
86
|
+
country_entity_1.Country,
|
|
87
|
+
sys_role_entity_1.SysRole,
|
|
88
|
+
sys_user_entity_1.SysUser,
|
|
89
|
+
translation_entity_1.Translation,
|
|
90
|
+
user_entity_1.User,
|
|
91
|
+
userDevice_entity_1.UserDevice,
|
|
92
|
+
];
|
|
79
93
|
}
|
|
80
94
|
|
|
81
95
|
|
|
@@ -656,12 +670,78 @@ var Gender;
|
|
|
656
670
|
|
|
657
671
|
/***/ }),
|
|
658
672
|
/* 19 */
|
|
673
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
677
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
678
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
679
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
680
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
681
|
+
};
|
|
682
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
683
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
684
|
+
};
|
|
685
|
+
var _a, _b;
|
|
686
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
687
|
+
exports.UserDevice = void 0;
|
|
688
|
+
const sequelize_typescript_1 = __webpack_require__(6);
|
|
689
|
+
const user_entity_1 = __webpack_require__(16);
|
|
690
|
+
const status_1 = __webpack_require__(9);
|
|
691
|
+
const osName_1 = __webpack_require__(11);
|
|
692
|
+
let UserDevice = class UserDevice extends sequelize_typescript_1.Model {
|
|
693
|
+
userId;
|
|
694
|
+
deviceId;
|
|
695
|
+
fcmToken;
|
|
696
|
+
status;
|
|
697
|
+
osSystem;
|
|
698
|
+
user;
|
|
699
|
+
};
|
|
700
|
+
exports.UserDevice = UserDevice;
|
|
701
|
+
__decorate([
|
|
702
|
+
(0, sequelize_typescript_1.ForeignKey)(() => user_entity_1.User),
|
|
703
|
+
sequelize_typescript_1.Column,
|
|
704
|
+
__metadata("design:type", Number)
|
|
705
|
+
], UserDevice.prototype, "userId", void 0);
|
|
706
|
+
__decorate([
|
|
707
|
+
sequelize_typescript_1.Column,
|
|
708
|
+
__metadata("design:type", String)
|
|
709
|
+
], UserDevice.prototype, "deviceId", void 0);
|
|
710
|
+
__decorate([
|
|
711
|
+
sequelize_typescript_1.Column,
|
|
712
|
+
__metadata("design:type", String)
|
|
713
|
+
], UserDevice.prototype, "fcmToken", void 0);
|
|
714
|
+
__decorate([
|
|
715
|
+
(0, sequelize_typescript_1.Column)({
|
|
716
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(status_1.Status)),
|
|
717
|
+
defaultValue: status_1.Status.ACTIVE,
|
|
718
|
+
}),
|
|
719
|
+
__metadata("design:type", typeof (_a = typeof status_1.Status !== "undefined" && status_1.Status) === "function" ? _a : Object)
|
|
720
|
+
], UserDevice.prototype, "status", void 0);
|
|
721
|
+
__decorate([
|
|
722
|
+
(0, sequelize_typescript_1.Column)({
|
|
723
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(osName_1.OsName)),
|
|
724
|
+
allowNull: true,
|
|
725
|
+
}),
|
|
726
|
+
__metadata("design:type", String)
|
|
727
|
+
], UserDevice.prototype, "osSystem", void 0);
|
|
728
|
+
__decorate([
|
|
729
|
+
(0, sequelize_typescript_1.BelongsTo)(() => user_entity_1.User),
|
|
730
|
+
__metadata("design:type", typeof (_b = typeof user_entity_1.User !== "undefined" && user_entity_1.User) === "function" ? _b : Object)
|
|
731
|
+
], UserDevice.prototype, "user", void 0);
|
|
732
|
+
exports.UserDevice = UserDevice = __decorate([
|
|
733
|
+
sequelize_typescript_1.Table
|
|
734
|
+
], UserDevice);
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
/***/ }),
|
|
738
|
+
/* 20 */
|
|
659
739
|
/***/ ((module) => {
|
|
660
740
|
|
|
661
741
|
module.exports = require("@nestjs/sequelize");
|
|
662
742
|
|
|
663
743
|
/***/ }),
|
|
664
|
-
/*
|
|
744
|
+
/* 21 */
|
|
665
745
|
/***/ ((module) => {
|
|
666
746
|
|
|
667
747
|
module.exports = require("@nestjs/config");
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model,
|
|
3
|
+
Table,
|
|
4
|
+
Column,
|
|
5
|
+
PrimaryKey,
|
|
6
|
+
AutoIncrement,
|
|
7
|
+
CreatedAt,
|
|
8
|
+
UpdatedAt,
|
|
9
|
+
DeletedAt,
|
|
10
|
+
ForeignKey,
|
|
11
|
+
BelongsTo,
|
|
12
|
+
BelongsToMany,
|
|
13
|
+
DataType,
|
|
14
|
+
} from 'sequelize-typescript';
|
|
15
|
+
import { User } from './user.entity';
|
|
16
|
+
import { Status } from '../utils/enums/status';
|
|
17
|
+
import { OsName } from '../utils/enums/osName';
|
|
18
|
+
|
|
19
|
+
@Table
|
|
20
|
+
export class UserDevice extends Model {
|
|
21
|
+
@ForeignKey(() => User)
|
|
22
|
+
@Column
|
|
23
|
+
userId!: number;
|
|
24
|
+
@Column
|
|
25
|
+
deviceId?: string;
|
|
26
|
+
@Column
|
|
27
|
+
fcmToken?: string;
|
|
28
|
+
@Column({
|
|
29
|
+
type: DataType.ENUM(...Object.values(Status)),
|
|
30
|
+
defaultValue: Status.ACTIVE,
|
|
31
|
+
})
|
|
32
|
+
status: Status;
|
|
33
|
+
|
|
34
|
+
@Column({
|
|
35
|
+
type: DataType.ENUM(...Object.values(OsName)),
|
|
36
|
+
allowNull: true,
|
|
37
|
+
})
|
|
38
|
+
osSystem: string;
|
|
39
|
+
@BelongsTo(() => User)
|
|
40
|
+
user: User;
|
|
41
|
+
}
|
|
@@ -6,7 +6,17 @@ import { Area } from './entities/area.entity';
|
|
|
6
6
|
import { SysRole } from './entities/sys.role.entity';
|
|
7
7
|
import { SysUser } from './entities/sys.user.entity';
|
|
8
8
|
import { User } from './entities/user.entity';
|
|
9
|
+
import { UserDevice } from './entities/userDevice.entity';
|
|
9
10
|
|
|
10
11
|
export function getDbModels(): ModelCtor[] {
|
|
11
|
-
return [
|
|
12
|
+
return [
|
|
13
|
+
ApiKey,
|
|
14
|
+
Area,
|
|
15
|
+
Country,
|
|
16
|
+
SysRole,
|
|
17
|
+
SysUser,
|
|
18
|
+
Translation,
|
|
19
|
+
User,
|
|
20
|
+
UserDevice,
|
|
21
|
+
];
|
|
12
22
|
}
|
package/package.json
CHANGED