@tabletennisshop/common 1.0.19 → 1.0.21
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.
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UserStatusEnum = void 0;
|
4
|
+
var UserStatusEnum;
|
5
|
+
(function (UserStatusEnum) {
|
6
|
+
UserStatusEnum["Enalble"] = "enable";
|
7
|
+
UserStatusEnum["Disable"] = "disable";
|
8
|
+
})(UserStatusEnum || (exports.UserStatusEnum = UserStatusEnum = {}));
|
@@ -3,6 +3,7 @@ export interface IAddress {
|
|
3
3
|
province: string;
|
4
4
|
district: string;
|
5
5
|
ward: string;
|
6
|
+
address: string;
|
6
7
|
phone_number: string;
|
7
8
|
}
|
8
9
|
export declare const AddressSchema: Schema<IAddress, import("mongoose").Model<IAddress, any, any, any, import("mongoose").Document<unknown, any, IAddress, any> & IAddress & {
|
@@ -6,6 +6,7 @@ exports.AddressSchema = new mongoose_1.Schema({
|
|
6
6
|
province: { type: String, required: true },
|
7
7
|
district: { type: String, required: true },
|
8
8
|
ward: { type: String, required: true },
|
9
|
+
address: { type: String, required: true },
|
9
10
|
phone_number: { type: String, required: true },
|
10
11
|
}, { _id: false } //This schema don't need Address Schema
|
11
12
|
);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Model, Document } from 'mongoose';
|
2
2
|
import { IAddress } from './address.schema';
|
3
|
+
import { UserStatusEnum } from '../enums/user-status.enum';
|
3
4
|
export interface UserAttrs {
|
4
5
|
username: string;
|
5
6
|
email: string;
|
@@ -7,11 +8,7 @@ export interface UserAttrs {
|
|
7
8
|
full_name: string;
|
8
9
|
addresses: IAddress[];
|
9
10
|
type: string;
|
10
|
-
|
11
|
-
district: string;
|
12
|
-
ward: string;
|
13
|
-
phone_number: string;
|
14
|
-
status: string;
|
11
|
+
status: UserStatusEnum;
|
15
12
|
}
|
16
13
|
interface UserDoc extends Document {
|
17
14
|
username: string;
|
@@ -20,10 +17,7 @@ interface UserDoc extends Document {
|
|
20
17
|
full_name: string;
|
21
18
|
addresses: IAddress[];
|
22
19
|
type: string;
|
23
|
-
|
24
|
-
district: string;
|
25
|
-
ward: string;
|
26
|
-
phone_number: string;
|
20
|
+
status: UserStatusEnum;
|
27
21
|
}
|
28
22
|
interface UserModel extends Model<UserDoc> {
|
29
23
|
build(attrs: UserAttrs): UserDoc;
|
@@ -14,6 +14,7 @@ const mongoose_1 = require("mongoose");
|
|
14
14
|
const password_1 = require("../services/password");
|
15
15
|
const user_enum_1 = require("../enums/user.enum");
|
16
16
|
const address_schema_1 = require("./address.schema");
|
17
|
+
const user_status_enum_1 = require("../enums/user-status.enum");
|
17
18
|
const UserSchema = new mongoose_1.Schema({
|
18
19
|
username: { type: String, required: true, unique: true, minlength: 5 },
|
19
20
|
email: { type: String, required: true, unique: true },
|
@@ -23,6 +24,7 @@ const UserSchema = new mongoose_1.Schema({
|
|
23
24
|
{ type: address_schema_1.AddressSchema, required: true }
|
24
25
|
],
|
25
26
|
type: { type: String, enum: Object.values(user_enum_1.UserEnum), required: true },
|
27
|
+
status: { type: String, enum: Object.values(user_status_enum_1.UserStatusEnum), required: true }
|
26
28
|
}, {
|
27
29
|
timestamps: true, // Adds createdAt and updatedAt fields automatically
|
28
30
|
collection: "user"
|