first commit
This commit is contained in:
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateCustomerNumber = generateCustomerNumber;
|
||||
exports.generateContractNumber = generateContractNumber;
|
||||
exports.paginate = paginate;
|
||||
exports.buildPaginationResponse = buildPaginationResponse;
|
||||
function generateCustomerNumber() {
|
||||
const timestamp = Date.now().toString(36).toUpperCase();
|
||||
const random = Math.random().toString(36).substring(2, 6).toUpperCase();
|
||||
return `K${timestamp}${random}`;
|
||||
}
|
||||
function generateContractNumber(type) {
|
||||
const prefix = type.substring(0, 3).toUpperCase();
|
||||
const timestamp = Date.now().toString(36).toUpperCase();
|
||||
const random = Math.random().toString(36).substring(2, 5).toUpperCase();
|
||||
return `${prefix}-${timestamp}${random}`;
|
||||
}
|
||||
function paginate(page = 1, limit = 20) {
|
||||
const skip = (page - 1) * limit;
|
||||
return { skip, take: limit };
|
||||
}
|
||||
function buildPaginationResponse(page, limit, total) {
|
||||
return {
|
||||
page,
|
||||
limit,
|
||||
total,
|
||||
totalPages: Math.ceil(total / limit),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
Reference in New Issue
Block a user