gemcap-be-common 1.4.150 → 1.4.152
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/models/FinancialSpreading.model.d.ts +0 -1
- package/models/FinancialSpreading.model.js +0 -4
- package/models/FinancialSpreading.model.ts +0 -5
- package/models/FinancialSpreadingSheet.model.d.ts +3 -0
- package/models/FinancialSpreadingSheet.model.js +6 -0
- package/models/FinancialSpreadingSheet.model.ts +8 -0
- package/models/_index.d.ts +6 -6
- package/package.json +1 -1
- package/services/financial-spreading.service.js +8 -6
- package/services/financial-spreading.service.ts +11 -9
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -52,7 +52,6 @@ export interface IFinancialSpreading {
|
|
|
52
52
|
month: number;
|
|
53
53
|
sheetId: mongoose.Types.ObjectId;
|
|
54
54
|
amount: number;
|
|
55
|
-
isFixedCost?: boolean;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
export interface IFinancialSpreadingDoc extends IFinancialSpreading, Document {
|
|
@@ -123,10 +122,6 @@ export const FinancialSpreadingSchema = new mongoose.Schema<IFinancialSpreading,
|
|
|
123
122
|
type: Number,
|
|
124
123
|
required: true,
|
|
125
124
|
},
|
|
126
|
-
isFixedCost: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
default: false,
|
|
129
|
-
},
|
|
130
125
|
},
|
|
131
126
|
{
|
|
132
127
|
timestamps: { createdAt: true, updatedAt: true },
|
|
@@ -124,6 +124,7 @@ export interface IFinancialSpreadingSheetView {
|
|
|
124
124
|
suborder: number;
|
|
125
125
|
isTotal: boolean;
|
|
126
126
|
isCalculated: boolean;
|
|
127
|
+
isFixedCost?: boolean;
|
|
127
128
|
}
|
|
128
129
|
export declare class FinancialSpreadingSheetDTO extends BasicDTO {
|
|
129
130
|
borrowerId: string;
|
|
@@ -134,6 +135,7 @@ export declare class FinancialSpreadingSheetDTO extends BasicDTO {
|
|
|
134
135
|
suborder: number;
|
|
135
136
|
isTotal: boolean;
|
|
136
137
|
isCalculated: boolean;
|
|
138
|
+
isFixedCost?: boolean;
|
|
137
139
|
}
|
|
138
140
|
export declare const financialSpreadingSheetViewValidationSchema: Joi.ObjectSchema<IFinancialSpreadingSheetView>;
|
|
139
141
|
export interface IFinancialSpreadingSheet {
|
|
@@ -145,6 +147,7 @@ export interface IFinancialSpreadingSheet {
|
|
|
145
147
|
suborder: number;
|
|
146
148
|
isTotal: boolean;
|
|
147
149
|
isCalculated: boolean;
|
|
150
|
+
isFixedCost?: boolean;
|
|
148
151
|
}
|
|
149
152
|
export interface IFinancialSpreadingSheetDoc extends IFinancialSpreadingSheet, Document {
|
|
150
153
|
_id: mongoose.Types.ObjectId;
|
|
@@ -140,6 +140,7 @@ class FinancialSpreadingSheetDTO extends db_data_helper_1.BasicDTO {
|
|
|
140
140
|
suborder;
|
|
141
141
|
isTotal;
|
|
142
142
|
isCalculated;
|
|
143
|
+
isFixedCost;
|
|
143
144
|
}
|
|
144
145
|
exports.FinancialSpreadingSheetDTO = FinancialSpreadingSheetDTO;
|
|
145
146
|
exports.financialSpreadingSheetViewValidationSchema = joi_1.default.object({
|
|
@@ -152,6 +153,7 @@ exports.financialSpreadingSheetViewValidationSchema = joi_1.default.object({
|
|
|
152
153
|
suborder: joi_1.default.number().integer().required(),
|
|
153
154
|
isTotal: joi_1.default.boolean().required(),
|
|
154
155
|
isCalculated: joi_1.default.boolean().required(),
|
|
156
|
+
isFixedCost: joi_1.default.boolean().allow(null),
|
|
155
157
|
});
|
|
156
158
|
exports.FinancialSpreadingSheetSchema = new mongoose_1.default.Schema({
|
|
157
159
|
borrowerId: {
|
|
@@ -201,6 +203,10 @@ exports.FinancialSpreadingSheetSchema = new mongoose_1.default.Schema({
|
|
|
201
203
|
type: Boolean,
|
|
202
204
|
required: true,
|
|
203
205
|
},
|
|
206
|
+
isFixedCost: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: false,
|
|
209
|
+
},
|
|
204
210
|
}, {
|
|
205
211
|
timestamps: { createdAt: true, updatedAt: true },
|
|
206
212
|
});
|
|
@@ -141,6 +141,7 @@ export interface IFinancialSpreadingSheetView {
|
|
|
141
141
|
suborder: number;
|
|
142
142
|
isTotal: boolean;
|
|
143
143
|
isCalculated: boolean;
|
|
144
|
+
isFixedCost?: boolean;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
export class FinancialSpreadingSheetDTO extends BasicDTO {
|
|
@@ -152,6 +153,7 @@ export class FinancialSpreadingSheetDTO extends BasicDTO {
|
|
|
152
153
|
suborder: number;
|
|
153
154
|
isTotal: boolean;
|
|
154
155
|
isCalculated: boolean;
|
|
156
|
+
isFixedCost?: boolean;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
export const financialSpreadingSheetViewValidationSchema = Joi.object<IFinancialSpreadingSheetView>({
|
|
@@ -164,6 +166,7 @@ export const financialSpreadingSheetViewValidationSchema = Joi.object<IFinancial
|
|
|
164
166
|
suborder: Joi.number().integer().required(),
|
|
165
167
|
isTotal: Joi.boolean().required(),
|
|
166
168
|
isCalculated: Joi.boolean().required(),
|
|
169
|
+
isFixedCost: Joi.boolean().allow(null),
|
|
167
170
|
});
|
|
168
171
|
|
|
169
172
|
export interface IFinancialSpreadingSheet {
|
|
@@ -175,6 +178,7 @@ export interface IFinancialSpreadingSheet {
|
|
|
175
178
|
suborder: number;
|
|
176
179
|
isTotal: boolean;
|
|
177
180
|
isCalculated: boolean;
|
|
181
|
+
isFixedCost?: boolean;
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
export interface IFinancialSpreadingSheetDoc extends IFinancialSpreadingSheet, Document {
|
|
@@ -249,6 +253,10 @@ export const FinancialSpreadingSheetSchema = new mongoose.Schema<IFinancialSprea
|
|
|
249
253
|
type: Boolean,
|
|
250
254
|
required: true,
|
|
251
255
|
},
|
|
256
|
+
isFixedCost: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: false,
|
|
259
|
+
},
|
|
252
260
|
},
|
|
253
261
|
{
|
|
254
262
|
timestamps: { createdAt: true, updatedAt: true },
|
package/models/_index.d.ts
CHANGED
|
@@ -31,10 +31,10 @@ export declare const allSchemas: {
|
|
|
31
31
|
createdAt: NativeDate;
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
|
-
amount: number;
|
|
35
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
36
34
|
order: number;
|
|
35
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
37
36
|
apDate: Date;
|
|
37
|
+
amount: number;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -45,10 +45,10 @@ export declare const allSchemas: {
|
|
|
45
45
|
createdAt: NativeDate;
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
|
-
amount: number;
|
|
49
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
50
48
|
order: number;
|
|
49
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
51
50
|
apDate: Date;
|
|
51
|
+
amount: number;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -59,10 +59,10 @@ export declare const allSchemas: {
|
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
|
-
amount: number;
|
|
63
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
64
62
|
order: number;
|
|
63
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
65
64
|
apDate: Date;
|
|
65
|
+
amount: number;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -175,13 +175,17 @@ class FinancialSpreadingService {
|
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
177
177
|
redundantSheetIdSet.delete(sheet._id);
|
|
178
|
-
|
|
179
|
-
.findByIdAndUpdate(sheet._id, {
|
|
178
|
+
const update = {
|
|
180
179
|
name: sheet.name,
|
|
181
180
|
order: sheet.order,
|
|
182
181
|
suborder: sheet.suborder,
|
|
183
182
|
rowType: sheet.rowType,
|
|
184
|
-
}
|
|
183
|
+
};
|
|
184
|
+
if (sheet.isFixedCost) {
|
|
185
|
+
update.isFixedCost = sheet.isFixedCost;
|
|
186
|
+
}
|
|
187
|
+
await FinancialSpreadingSheet_model_1.FinancialSpreadingSheet
|
|
188
|
+
.findByIdAndUpdate(sheet._id, update, { new: true })
|
|
185
189
|
.lean();
|
|
186
190
|
}
|
|
187
191
|
}));
|
|
@@ -196,9 +200,7 @@ class FinancialSpreadingService {
|
|
|
196
200
|
const update = {
|
|
197
201
|
amount: rest.amount,
|
|
198
202
|
};
|
|
199
|
-
|
|
200
|
-
update.isFixedCost = item.isFixedCost;
|
|
201
|
-
}
|
|
203
|
+
console.debug({ _id, update });
|
|
202
204
|
if (_id.includes('new_')) {
|
|
203
205
|
if (rest.sheetId.includes('new_')) {
|
|
204
206
|
rest.sheetId = sheetMap[rest.sheetId];
|
|
@@ -208,13 +208,17 @@ export class FinancialSpreadingService {
|
|
|
208
208
|
sheetMap[sheet._id] = newSheet._id.toString();
|
|
209
209
|
} else {
|
|
210
210
|
redundantSheetIdSet.delete(sheet._id);
|
|
211
|
+
const update: Partial<IFinancialSpreadingSheet> = {
|
|
212
|
+
name: sheet.name,
|
|
213
|
+
order: sheet.order,
|
|
214
|
+
suborder: sheet.suborder,
|
|
215
|
+
rowType: sheet.rowType as EFinanceSpreadingPLTotal | EFinanceSpreadingBSTotal,
|
|
216
|
+
}
|
|
217
|
+
if (sheet.isFixedCost) {
|
|
218
|
+
update.isFixedCost = sheet.isFixedCost;
|
|
219
|
+
}
|
|
211
220
|
await FinancialSpreadingSheet
|
|
212
|
-
.findByIdAndUpdate(sheet._id, {
|
|
213
|
-
name: sheet.name,
|
|
214
|
-
order: sheet.order,
|
|
215
|
-
suborder: sheet.suborder,
|
|
216
|
-
rowType: sheet.rowType,
|
|
217
|
-
}, { new: true })
|
|
221
|
+
.findByIdAndUpdate(sheet._id, update, { new: true })
|
|
218
222
|
.lean();
|
|
219
223
|
}
|
|
220
224
|
}));
|
|
@@ -232,9 +236,7 @@ export class FinancialSpreadingService {
|
|
|
232
236
|
amount: rest.amount,
|
|
233
237
|
};
|
|
234
238
|
|
|
235
|
-
|
|
236
|
-
update.isFixedCost = item.isFixedCost;
|
|
237
|
-
}
|
|
239
|
+
console.debug({ _id, update });
|
|
238
240
|
|
|
239
241
|
if (_id.includes('new_')) {
|
|
240
242
|
if (rest.sheetId.includes('new_')) {
|