[MAJOR][FIRSTCOMMIT] Added basic routes, controllers, repos to kanban service (no postgres yet)

This commit is contained in:
2025-09-27 14:09:35 +05:30
parent f283f6043f
commit fd7ceca2ef
109 changed files with 3554 additions and 444 deletions

50
lib/models/task.model.js Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
// **** Variables **** //
Object.defineProperty(exports, "__esModule", { value: true });
const INVALID_CONSTRUCTOR_PARAM = 'titleOrObj arg must be a string or an object with the appropriate task keys.';
// **** Functions **** //
/**
* Create new Task.
*/
function new_(boardId, title, status, description, createdAt, updatedAt, id) {
const now = new Date().toISOString();
return {
id: (id !== null && id !== void 0 ? id : -1),
boardId: (boardId !== null && boardId !== void 0 ? boardId : -1),
title: (title !== null && title !== void 0 ? title : ''),
status: (status !== null && status !== void 0 ? status : 'todo'),
description,
createdAt: (createdAt !== null && createdAt !== void 0 ? createdAt : now),
updatedAt: (updatedAt !== null && updatedAt !== void 0 ? updatedAt : now),
};
}
/**
* Get task instance from object.
*/
function from(param) {
if (!isTask(param)) {
throw new Error(INVALID_CONSTRUCTOR_PARAM);
}
const p = param;
return new_(p.boardId, p.title, p.status, p.description, p.createdAt, p.updatedAt, p.id);
}
/**
* See if the param meets criteria to be a task.
*/
function isTask(arg) {
return (!!arg &&
typeof arg === 'object' &&
'id' in arg &&
'boardId' in arg &&
'title' in arg &&
'status' in arg &&
'createdAt' in arg &&
'updatedAt' in arg);
}
// **** Export default **** //
exports.default = {
new: new_,
from,
isTask,
};
//# sourceMappingURL=task.model.js.map