@kipicore/dbcore 1.1.426 → 1.1.427
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/db/psql/migrations/20260413045926-user_offer_discount_model.js +10 -10
- package/dist/db/psql/migrations/20260414053538-user_offer_discount_model_update.d.ts +2 -0
- package/dist/db/psql/migrations/20260414053538-user_offer_discount_model_update.js +21 -0
- package/dist/interfaces/offerAndDiscountInterface.d.ts +1 -0
- package/dist/interfaces/userHasOfferAndDiscountInterface.d.ts +1 -1
- package/dist/models/mongodb/offerAndDiscountModel.js +4 -0
- package/dist/models/psql/userHasOfferAndDiscountModel.d.ts +1 -1
- package/dist/models/psql/userHasOfferAndDiscountModel.js +6 -10
- package/package.json +1 -1
|
@@ -38,11 +38,11 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
38
38
|
allowNull: true,
|
|
39
39
|
field: 'offer_type',
|
|
40
40
|
},
|
|
41
|
-
limitUserCount: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
41
|
+
// limitUserCount: {
|
|
42
|
+
// type: Sequelize.INTEGER,
|
|
43
|
+
// allowNull: true,
|
|
44
|
+
// field: 'limit_user_count',
|
|
45
|
+
// },
|
|
46
46
|
status: {
|
|
47
47
|
type: Sequelize.STRING,
|
|
48
48
|
allowNull: true,
|
|
@@ -129,11 +129,11 @@ const up = async (queryInterface, Sequelize) => {
|
|
|
129
129
|
allowNull: true,
|
|
130
130
|
field: 'offer_type',
|
|
131
131
|
},
|
|
132
|
-
limitUserCount: {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
132
|
+
// limitUserCount: {
|
|
133
|
+
// type: Sequelize.INTEGER,
|
|
134
|
+
// allowNull: true,
|
|
135
|
+
// field: 'limit_user_count',
|
|
136
|
+
// },
|
|
137
137
|
status: {
|
|
138
138
|
type: Sequelize.STRING,
|
|
139
139
|
allowNull: true,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('user_has_offer_and_discount');
|
|
4
|
+
if (!table.note) {
|
|
5
|
+
await queryInterface.addColumn('user_has_offer_and_discount', 'note', {
|
|
6
|
+
type: Sequelize.TEXT,
|
|
7
|
+
field: 'note',
|
|
8
|
+
allowNull: true,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const down = async (queryInterface) => {
|
|
13
|
+
const table = await queryInterface.describeTable('user_has_offer_and_discount');
|
|
14
|
+
if (table.note) {
|
|
15
|
+
await queryInterface.removeColumn('user_has_offer_and_discount', 'note');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
module.exports = {
|
|
19
|
+
up,
|
|
20
|
+
down,
|
|
21
|
+
};
|
|
@@ -7,9 +7,9 @@ export interface IUserHasOfferAndDiscountModelAttributes extends IDefaultAttribu
|
|
|
7
7
|
userId: string;
|
|
8
8
|
discount: number;
|
|
9
9
|
offerType: OFFER_TYPE;
|
|
10
|
-
limitUserCount?: number;
|
|
11
10
|
status: OFFER_STATUS;
|
|
12
11
|
offerAndDiscountId: string;
|
|
13
12
|
applyDiscountAmount: number;
|
|
14
13
|
offerApplyFor: OFFER_NAME;
|
|
14
|
+
note?: string;
|
|
15
15
|
}
|
|
@@ -133,6 +133,10 @@ const OfferAndDiscountSchema = new mongoose_1.Schema({
|
|
|
133
133
|
enum: Object.values(constants_1.OFFER_COMMAND_STATUS),
|
|
134
134
|
default: constants_1.OFFER_COMMAND_STATUS.ACTIVE,
|
|
135
135
|
},
|
|
136
|
+
userId: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: '',
|
|
139
|
+
},
|
|
136
140
|
createdBy: {
|
|
137
141
|
type: String,
|
|
138
142
|
},
|
|
@@ -8,11 +8,11 @@ declare class UserHasOfferAndDiscountModel extends Model<IUserHasOfferAndDiscoun
|
|
|
8
8
|
userId: string;
|
|
9
9
|
discount: number;
|
|
10
10
|
offerType: OFFER_TYPE;
|
|
11
|
-
limitUserCount?: number;
|
|
12
11
|
status: OFFER_STATUS;
|
|
13
12
|
offerAndDiscountId: string;
|
|
14
13
|
applyDiscountAmount: number;
|
|
15
14
|
offerApplyFor: OFFER_NAME;
|
|
15
|
+
note: string;
|
|
16
16
|
createdBy: string;
|
|
17
17
|
updatedBy: string;
|
|
18
18
|
deletedBy: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sequelize_1 = require("sequelize");
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
4
|
const index_1 = require("./index");
|
|
6
5
|
class UserHasOfferAndDiscountModel extends sequelize_1.Model {
|
|
7
6
|
static associate(models) {
|
|
@@ -78,17 +77,15 @@ UserHasOfferAndDiscountModel.init({
|
|
|
78
77
|
allowNull: true,
|
|
79
78
|
},
|
|
80
79
|
offerType: {
|
|
81
|
-
type: sequelize_1.DataTypes.
|
|
82
|
-
values: Object.values(constants_1.OFFER_TYPE),
|
|
80
|
+
type: sequelize_1.DataTypes.STRING,
|
|
83
81
|
allowNull: true,
|
|
84
82
|
},
|
|
85
|
-
|
|
86
|
-
type: sequelize_1.DataTypes.
|
|
83
|
+
status: {
|
|
84
|
+
type: sequelize_1.DataTypes.STRING,
|
|
87
85
|
allowNull: true,
|
|
88
86
|
},
|
|
89
|
-
|
|
90
|
-
type: sequelize_1.DataTypes.
|
|
91
|
-
values: Object.values(constants_1.OFFER_STATUS),
|
|
87
|
+
note: {
|
|
88
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
92
89
|
allowNull: true,
|
|
93
90
|
},
|
|
94
91
|
offerAndDiscountId: {
|
|
@@ -100,8 +97,7 @@ UserHasOfferAndDiscountModel.init({
|
|
|
100
97
|
allowNull: true,
|
|
101
98
|
},
|
|
102
99
|
offerApplyFor: {
|
|
103
|
-
type: sequelize_1.DataTypes.
|
|
104
|
-
values: Object.values(constants_1.OFFER_NAME),
|
|
100
|
+
type: sequelize_1.DataTypes.STRING,
|
|
105
101
|
allowNull: true,
|
|
106
102
|
},
|
|
107
103
|
}, {
|
package/package.json
CHANGED