diff --git a/.gitignore b/.gitignore
index 0ec7d59..f8ac030 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,3 +135,4 @@ dist/
.DS_Store
/generated/prisma
+lib
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..af6434b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "typescript.tsdk": "node_modules/typescript/lib"
+}
\ No newline at end of file
diff --git a/lib/constants/EnvVars.js b/lib/constants/EnvVars.js
deleted file mode 100644
index cbaa257..0000000
--- a/lib/constants/EnvVars.js
+++ /dev/null
@@ -1,29 +0,0 @@
-"use strict";
-/**
- * Environments variables declared here.
- */
-var _a, _b, _c, _d, _e, _f, _g;
-Object.defineProperty(exports, "__esModule", { value: true });
-/* eslint-disable node/no-process-env */
-exports.default = {
- NodeEnv: ((_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : ''),
- Port: ((_b = process.env.PORT) !== null && _b !== void 0 ? _b : 0),
- CookieProps: {
- Key: 'ExpressGeneratorTs',
- Secret: ((_c = process.env.COOKIE_SECRET) !== null && _c !== void 0 ? _c : ''),
- // Casing to match express cookie options
- Options: {
- httpOnly: true,
- signed: true,
- path: ((_d = process.env.COOKIE_PATH) !== null && _d !== void 0 ? _d : ''),
- maxAge: Number((_e = process.env.COOKIE_EXP) !== null && _e !== void 0 ? _e : 0),
- domain: ((_f = process.env.COOKIE_DOMAIN) !== null && _f !== void 0 ? _f : ''),
- secure: (process.env.SECURE_COOKIE === 'true'),
- },
- },
- Jwt: {
- Secret: ((_g = process.env.JWT_SECRET) !== null && _g !== void 0 ? _g : ''),
- Exp: (process.env.COOKIE_EXP && process.env.COOKIE_EXP !== '' ? process.env.COOKIE_EXP : '1h'), // exp at the same time as the cookie
- },
-};
-//# sourceMappingURL=EnvVars.js.map
\ No newline at end of file
diff --git a/lib/constants/EnvVars.js.map b/lib/constants/EnvVars.js.map
deleted file mode 100644
index 1a2395d..0000000
--- a/lib/constants/EnvVars.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"EnvVars.js","sourceRoot":"","sources":["../../src/constants/EnvVars.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,wCAAwC;AAGxC,kBAAe;IACb,OAAO,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,EAAE,CAAC;IACrC,IAAI,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,mCAAI,CAAC,CAAC;IAC7B,WAAW,EAAE;QACX,GAAG,EAAE,oBAAoB;QACzB,MAAM,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,mCAAI,EAAE,CAAC;QACzC,yCAAyC;QACzC,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,WAAW,mCAAI,EAAE,CAAC;YACrC,MAAM,EAAE,MAAM,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,UAAU,mCAAI,CAAC,CAAC;YAC3C,MAAM,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,mCAAI,EAAE,CAAC;YACzC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;SAC/C;KACF;IACD,GAAG,EAAE;QACH,MAAM,EAAE,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,UAAU,mCAAK,EAAE,CAAC;QACvC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,qCAAqC;KACtI;CACO,CAAC"}
\ No newline at end of file
diff --git a/lib/constants/HttpStatusCodes.js b/lib/constants/HttpStatusCodes.js
deleted file mode 100644
index 96b253b..0000000
--- a/lib/constants/HttpStatusCodes.js
+++ /dev/null
@@ -1,327 +0,0 @@
-"use strict";
-/* eslint-disable max-len */
-/**
- * This file was copied from here: https://gist.github.com/scokmen/f813c904ef79022e84ab2409574d1b45
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-/**
- * Hypertext Transfer Protocol (HTTP) response status codes.
- * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
- */
-var HttpStatusCodes;
-(function (HttpStatusCodes) {
- /**
- * The server has received the request headers and the client should proceed to send the request body
- * (in the case of a request for which a body needs to be sent; for example, a POST request).
- * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
- * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
- * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.
- */
- HttpStatusCodes[HttpStatusCodes["CONTINUE"] = 100] = "CONTINUE";
- /**
- * The requester has asked the server to switch protocols and the server has agreed to do so.
- */
- HttpStatusCodes[HttpStatusCodes["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
- /**
- * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
- * This code indicates that the server has received and is processing the request, but no response is available yet.
- * This prevents the client from timing out and assuming the request was lost.
- */
- HttpStatusCodes[HttpStatusCodes["PROCESSING"] = 102] = "PROCESSING";
- /**
- * Standard response for successful HTTP requests.
- * The actual response will depend on the request method used.
- * In a GET request, the response will contain an entity corresponding to the requested resource.
- * In a POST request, the response will contain an entity describing or containing the result of the action.
- */
- HttpStatusCodes[HttpStatusCodes["OK"] = 200] = "OK";
- /**
- * The request has been fulfilled, resulting in the creation of a new resource.
- */
- HttpStatusCodes[HttpStatusCodes["CREATED"] = 201] = "CREATED";
- /**
- * The request has been accepted for processing, but the processing has not been completed.
- * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
- */
- HttpStatusCodes[HttpStatusCodes["ACCEPTED"] = 202] = "ACCEPTED";
- /**
- * SINCE HTTP/1.1
- * The server is a transforming proxy that received a 200 OK from its origin,
- * but is returning a modified version of the origin's response.
- */
- HttpStatusCodes[HttpStatusCodes["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
- /**
- * The server successfully processed the request and is not returning any content.
- */
- HttpStatusCodes[HttpStatusCodes["NO_CONTENT"] = 204] = "NO_CONTENT";
- /**
- * The server successfully processed the request, but is not returning any content.
- * Unlike a 204 response, this response requires that the requester reset the document view.
- */
- HttpStatusCodes[HttpStatusCodes["RESET_CONTENT"] = 205] = "RESET_CONTENT";
- /**
- * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
- * The range header is used by HTTP clients to enable resuming of interrupted downloads,
- * or split a download into multiple simultaneous streams.
- */
- HttpStatusCodes[HttpStatusCodes["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
- /**
- * The message body that follows is an XML message and can contain a number of separate response codes,
- * depending on how many sub-requests were made.
- */
- HttpStatusCodes[HttpStatusCodes["MULTI_STATUS"] = 207] = "MULTI_STATUS";
- /**
- * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
- * and are not being included again.
- */
- HttpStatusCodes[HttpStatusCodes["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
- /**
- * The server has fulfilled a request for the resource,
- * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
- */
- HttpStatusCodes[HttpStatusCodes["IM_USED"] = 226] = "IM_USED";
- /**
- * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
- * For example, this code could be used to present multiple video format options,
- * to list files with different filename extensions, or to suggest word-sense disambiguation.
- */
- HttpStatusCodes[HttpStatusCodes["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
- /**
- * This and all future requests should be directed to the given URI.
- */
- HttpStatusCodes[HttpStatusCodes["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
- /**
- * This is an example of industry practice contradicting the standard.
- * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
- * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
- * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
- * to distinguish between the two behaviours. However, some Web applications and frameworks
- * use the 302 status code as if it were the 303.
- */
- HttpStatusCodes[HttpStatusCodes["FOUND"] = 302] = "FOUND";
- /**
- * SINCE HTTP/1.1
- * The response to the request can be found under another URI using a GET method.
- * When received in response to a POST (or PUT/DELETE), the client should presume that
- * the server has received the data and should issue a redirect with a separate GET message.
- */
- HttpStatusCodes[HttpStatusCodes["SEE_OTHER"] = 303] = "SEE_OTHER";
- /**
- * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
- * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
- */
- HttpStatusCodes[HttpStatusCodes["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
- /**
- * SINCE HTTP/1.1
- * The requested resource is available only through a proxy, the address for which is provided in the response.
- * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
- */
- HttpStatusCodes[HttpStatusCodes["USE_PROXY"] = 305] = "USE_PROXY";
- /**
- * No longer used. Originally meant "Subsequent requests should use the specified proxy."
- */
- HttpStatusCodes[HttpStatusCodes["SWITCH_PROXY"] = 306] = "SWITCH_PROXY";
- /**
- * SINCE HTTP/1.1
- * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
- * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
- * For example, a POST request should be repeated using another POST request.
- */
- HttpStatusCodes[HttpStatusCodes["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
- /**
- * The request and all future requests should be repeated using another URI.
- * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
- * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
- */
- HttpStatusCodes[HttpStatusCodes["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
- /**
- * The server cannot or will not process the request due to an apparent client error
- * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
- */
- HttpStatusCodes[HttpStatusCodes["BAD_REQUEST"] = 400] = "BAD_REQUEST";
- /**
- * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
- * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
- * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
- * "unauthenticated",i.e. the user does not have the necessary credentials.
- */
- HttpStatusCodes[HttpStatusCodes["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
- /**
- * Reserved for future use. The original intention was that this code might be used as part of some form of digital
- * cash or micro payment scheme, but that has not happened, and this code is not usually used.
- * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
- */
- HttpStatusCodes[HttpStatusCodes["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
- /**
- * The request was valid, but the server is refusing action.
- * The user might not have the necessary permissions for a resource.
- */
- HttpStatusCodes[HttpStatusCodes["FORBIDDEN"] = 403] = "FORBIDDEN";
- /**
- * The requested resource could not be found but may be available in the future.
- * Subsequent requests by the client are permissible.
- */
- HttpStatusCodes[HttpStatusCodes["NOT_FOUND"] = 404] = "NOT_FOUND";
- /**
- * A request method is not supported for the requested resource;
- * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
- */
- HttpStatusCodes[HttpStatusCodes["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
- /**
- * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
- */
- HttpStatusCodes[HttpStatusCodes["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
- /**
- * The client must first authenticate itself with the proxy.
- */
- HttpStatusCodes[HttpStatusCodes["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
- /**
- * The server timed out waiting for the request.
- * According to HTTP specifications:
- * "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
- */
- HttpStatusCodes[HttpStatusCodes["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
- /**
- * Indicates that the request could not be processed because of conflict in the request,
- * such as an edit conflict between multiple simultaneous updates.
- */
- HttpStatusCodes[HttpStatusCodes["CONFLICT"] = 409] = "CONFLICT";
- /**
- * Indicates that the resource requested is no longer available and will not be available again.
- * This should be used when a resource has been intentionally removed and the resource should be purged.
- * Upon receiving a 410 status code, the client should not request the resource in the future.
- * Clients such as search engines should remove the resource from their indices.
- * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
- */
- HttpStatusCodes[HttpStatusCodes["GONE"] = 410] = "GONE";
- /**
- * The request did not specify the length of its content, which is required by the requested resource.
- */
- HttpStatusCodes[HttpStatusCodes["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
- /**
- * The server does not meet one of the preconditions that the requester put on the request.
- */
- HttpStatusCodes[HttpStatusCodes["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
- /**
- * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
- */
- HttpStatusCodes[HttpStatusCodes["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
- /**
- * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
- * in which case it should be converted to a POST request.
- * Called "Request-URI Too Long" previously.
- */
- HttpStatusCodes[HttpStatusCodes["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
- /**
- * The request entity has a media type which the server or resource does not support.
- * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
- */
- HttpStatusCodes[HttpStatusCodes["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
- /**
- * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
- * For example, if the client asked for a part of the file that lies beyond the end of the file.
- * Called "Requested Range Not Satisfiable" previously.
- */
- HttpStatusCodes[HttpStatusCodes["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
- /**
- * The server cannot meet the requirements of the Expect request-header field.
- */
- HttpStatusCodes[HttpStatusCodes["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
- /**
- * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
- * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
- * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
- */
- HttpStatusCodes[HttpStatusCodes["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
- /**
- * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
- */
- HttpStatusCodes[HttpStatusCodes["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
- /**
- * The request was well-formed but was unable to be followed due to semantic errors.
- */
- HttpStatusCodes[HttpStatusCodes["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
- /**
- * The resource that is being accessed is locked.
- */
- HttpStatusCodes[HttpStatusCodes["LOCKED"] = 423] = "LOCKED";
- /**
- * The request failed due to failure of a previous request (e.g., a PROPPATCH).
- */
- HttpStatusCodes[HttpStatusCodes["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
- /**
- * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
- */
- HttpStatusCodes[HttpStatusCodes["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
- /**
- * The origin server requires the request to be conditional.
- * Intended to prevent "the 'lost update' problem, where a client
- * GETs a resource's state, modifies it, and PUTs it back to the server,
- * when meanwhile a third party has modified the state on the server, leading to a conflict."
- */
- HttpStatusCodes[HttpStatusCodes["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
- /**
- * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
- */
- HttpStatusCodes[HttpStatusCodes["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
- /**
- * The server is unwilling to process the request because either an individual header field,
- * or all the header fields collectively, are too large.
- */
- HttpStatusCodes[HttpStatusCodes["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
- /**
- * A server operator has received a legal demand to deny access to a resource or to a set of resources
- * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
- */
- HttpStatusCodes[HttpStatusCodes["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
- /**
- * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
- */
- HttpStatusCodes[HttpStatusCodes["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
- /**
- * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
- * Usually this implies future availability (e.g., a new feature of a web-service API).
- */
- HttpStatusCodes[HttpStatusCodes["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
- /**
- * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
- */
- HttpStatusCodes[HttpStatusCodes["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
- /**
- * The server is currently unavailable (because it is overloaded or down for maintenance).
- * Generally, this is a temporary state.
- */
- HttpStatusCodes[HttpStatusCodes["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
- /**
- * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
- */
- HttpStatusCodes[HttpStatusCodes["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
- /**
- * The server does not support the HTTP protocol version used in the request
- */
- HttpStatusCodes[HttpStatusCodes["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
- /**
- * Transparent content negotiation for the request results in a circular reference.
- */
- HttpStatusCodes[HttpStatusCodes["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
- /**
- * The server is unable to store the representation needed to complete the request.
- */
- HttpStatusCodes[HttpStatusCodes["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
- /**
- * The server detected an infinite loop while processing the request.
- */
- HttpStatusCodes[HttpStatusCodes["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
- /**
- * Further extensions to the request are required for the server to fulfill it.
- */
- HttpStatusCodes[HttpStatusCodes["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
- /**
- * The client needs to authenticate to gain network access.
- * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
- * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
- */
- HttpStatusCodes[HttpStatusCodes["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
-})(HttpStatusCodes || (HttpStatusCodes = {}));
-exports.default = HttpStatusCodes;
-//# sourceMappingURL=HttpStatusCodes.js.map
\ No newline at end of file
diff --git a/lib/constants/HttpStatusCodes.js.map b/lib/constants/HttpStatusCodes.js.map
deleted file mode 100644
index 9901b6f..0000000
--- a/lib/constants/HttpStatusCodes.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"HttpStatusCodes.js","sourceRoot":"","sources":["../../src/constants/HttpStatusCodes.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B;;GAEG;;AAEH;;;GAGG;AACH,IAAK,eAsXJ;AAtXD,WAAK,eAAe;IAEhB;;;;;;OAMG;IACH,+DAAc,CAAA;IAEd;;OAEG;IACH,qFAAyB,CAAA;IAEzB;;;;OAIG;IACH,mEAAgB,CAAA;IAEhB;;;;;OAKG;IACH,mDAAQ,CAAA;IAER;;OAEG;IACH,6DAAa,CAAA;IAEb;;;OAGG;IACH,+DAAc,CAAA;IAEd;;;;OAIG;IACH,yGAAmC,CAAA;IAEnC;;OAEG;IACH,mEAAgB,CAAA;IAEhB;;;OAGG;IACH,yEAAmB,CAAA;I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IAEvB;;OAEG;IACH,+EAAsB,CAAA;IAEtB;;;;;OAKG;IACH,yFAA2B,CAAA;IAE3B;;OAEG;IACH,iFAAuB,CAAA;IAEvB;;;OAGG;IACH,6GAAqC,CAAA;IAErC;;;OAGG;IACH,yGAAmC,CAAA;IAEnC;;OAEG;IACH,yFAA2B,CAAA;IAE3B;;;OAGG;IACH,6EAAqB,CAAA;IAErB;;OAEG;IACH,qEAAiB,CAAA;IAEjB;;;OAGG;IACH,qFAAyB,CAAA;IAEzB;;OAEG;IACH,6EAAqB,CAAA;IAErB;;OAEG;IACH,mGAAgC,CAAA;IAEhC;;OAEG;IACH,6FAA6B,CAAA;IAE7B;;OAEG;IACH,uFAA0B,CAAA;IAE1B;;OAEG;IACH,yEAAmB,CAAA;IAEnB;;OAEG;IACH,uEAAkB,CAAA;IAElB;;;;OAIG;IACH,6GAAqC,CAAA;AACzC,CAAC,EAtXI,eAAe,KAAf,eAAe,QAsXnB;AAED,kBAAe,eAAe,CAAC"}
\ No newline at end of file
diff --git a/lib/constants/misc.js b/lib/constants/misc.js
deleted file mode 100644
index 6f6641d..0000000
--- a/lib/constants/misc.js
+++ /dev/null
@@ -1,10 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.NodeEnvs = void 0;
-var NodeEnvs;
-(function (NodeEnvs) {
- NodeEnvs["Dev"] = "development";
- NodeEnvs["Test"] = "test";
- NodeEnvs["Production"] = "production";
-})(NodeEnvs || (exports.NodeEnvs = NodeEnvs = {}));
-//# sourceMappingURL=misc.js.map
\ No newline at end of file
diff --git a/lib/constants/misc.js.map b/lib/constants/misc.js.map
deleted file mode 100644
index 5e06715..0000000
--- a/lib/constants/misc.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/constants/misc.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,qCAAyB,CAAA;AAC3B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB"}
\ No newline at end of file
diff --git a/lib/controllers/board.controller.js b/lib/controllers/board.controller.js
deleted file mode 100644
index 1919d4c..0000000
--- a/lib/controllers/board.controller.js
+++ /dev/null
@@ -1,62 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const board_repo_1 = __importDefault(require("@src/repos/board.repo"));
-class BoardController {
- constructor() {
- // Get all boards for a user
- this.getBoardsByUserId = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const userId = +req.params.userId;
- const boards = await board_repo_1.default.getBoardsByUserId(userId);
- return res.json({ boards });
- };
- // Get single board by userId and boardId
- this.getBoardByUserId = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const userId = +req.params.userId;
- const boardId = +req.params.boardId;
- const board = await board_repo_1.default.getBoardByUserId(userId, boardId);
- return res.json({ board });
- };
- // Create board for a user
- this.createBoard = async (req, res) => {
- if (!req.body.name) {
- return res.status(400).json({ error: 'Board name required' });
- }
- const userId = +req.params.userId;
- const boardData = req.body;
- const board = await board_repo_1.default.createBoard(userId, boardData);
- return res.status(201).json({ board });
- };
- // Update board for a user
- this.updateBoard = async (req, res) => {
- if (!req.body.name) {
- return res.status(400).json({ error: 'Board name required' });
- }
- const userId = +req.params.userId;
- const boardId = +req.params.boardId;
- const boardData = req.body;
- const board = await board_repo_1.default.updateBoard(userId, boardId, boardData);
- return res.json({ board });
- };
- // Delete board for a user
- this.deleteBoard = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const userId = +req.params.userId;
- const boardId = +req.params.boardId;
- await board_repo_1.default.deleteBoard(userId, boardId);
- return res.status(204).end();
- };
- }
-}
-exports.default = new BoardController();
-//# sourceMappingURL=board.controller.js.map
\ No newline at end of file
diff --git a/lib/controllers/board.controller.js.map b/lib/controllers/board.controller.js.map
deleted file mode 100644
index 7a6c90f..0000000
--- a/lib/controllers/board.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"board.controller.js","sourceRoot":"","sources":["../../src/controllers/board.controller.ts"],"names":[],"mappings":";;;;;AACA,uEAA8C;AAI9C,MAAM,eAAe;IAArB;QACE,4BAA4B;QAC5B,sBAAiB,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACxD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YACzD,CAAC;YACD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,MAAM,GAAG,MAAM,oBAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACzD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC;QAEF,yCAAyC;QACzC,qBAAgB,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACvD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YACzD,CAAC;YACD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,MAAM,KAAK,GAAG,MAAM,oBAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,C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,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC;QAEF,0BAA0B;QAC1B,gBAAW,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YAClD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YACzD,CAAC;YACD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,MAAM,oBAAS,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,IAAI,eAAe,EAAE,CAAC"}
\ No newline at end of file
diff --git a/lib/controllers/task.controller.js b/lib/controllers/task.controller.js
deleted file mode 100644
index 6370561..0000000
--- a/lib/controllers/task.controller.js
+++ /dev/null
@@ -1,64 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const task_repo_1 = __importDefault(require("@src/repos/task.repo"));
-class TaskController {
- constructor() {
- // Get all tasks for a board
- this.getTasksByBoardId = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const boardId = +req.params.boardId;
- const tasks = await task_repo_1.default.getTasksByBoardId(boardId);
- return res.json({ tasks });
- };
- // Get single task by boardId and taskId
- this.getTaskByBoardId = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const boardId = +req.params.boardId;
- const taskId = +req.params.taskId;
- const task = await task_repo_1.default.getTaskByBoardId(boardId, taskId);
- return res.json({ task });
- };
- // Create task for a board
- this.createTask = async (req, res) => {
- // Dummy form validation
- if (!req.body.title) {
- return res.status(400).json({ error: 'Task title required' });
- }
- const boardId = +req.params.boardId;
- const taskData = req.body;
- const task = await task_repo_1.default.createTask(boardId, taskData);
- return res.status(201).json({ task });
- };
- // Update task for a board
- this.updateTask = async (req, res) => {
- // Dummy form validation
- if (!req.body.title) {
- return res.status(400).json({ error: 'Task title required' });
- }
- const boardId = +req.params.boardId;
- const taskId = +req.params.taskId;
- const taskData = req.body;
- const task = await task_repo_1.default.updateTask(boardId, taskId, taskData);
- return res.json({ task });
- };
- // Delete task for a board
- this.deleteTask = async (req, res) => {
- if (!req.headers.authorization) {
- return res.status(401).json({ error: 'Unauthorized' });
- }
- const boardId = +req.params.boardId;
- const taskId = +req.params.taskId;
- await task_repo_1.default.deleteTask(boardId, taskId);
- return res.status(204).end();
- };
- }
-}
-exports.default = new TaskController();
-//# sourceMappingURL=task.controller.js.map
\ No newline at end of file
diff --git a/lib/controllers/task.controller.js.map b/lib/controllers/task.controller.js.map
deleted file mode 100644
index d5097fb..0000000
--- a/lib/controllers/task.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controllers/task.controller.ts"],"names":[],"mappings":";;;;;AACA,qEAA4C;AAG5C,MAAM,cAAc;IAApB;QACE,4BAA4B;QAC5B,sBAAiB,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACxD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YACzD,CAAC;YACD,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC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CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,IAAI,cAAc,EAAE,CAAC"}
\ No newline at end of file
diff --git a/lib/controllers/user.controller.js b/lib/controllers/user.controller.js
deleted file mode 100644
index 751ac1d..0000000
--- a/lib/controllers/user.controller.js
+++ /dev/null
@@ -1,31 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const user_repo_1 = __importDefault(require("@src/repos/user.repo"));
-class UserController {
- constructor() {
- this.getAll = async (_, res) => {
- const users = await user_repo_1.default.getAll();
- return res.status(200).json({ users });
- };
- this.add = async (req, res) => {
- const user = req.body.user;
- await user_repo_1.default.add(user);
- return res.status(201).end();
- };
- this.update = async (req, res) => {
- const user = req.body.user;
- await user_repo_1.default.update(user);
- return res.status(200).end();
- };
- this.delete = async (req, res) => {
- const id = +req.params.id;
- await user_repo_1.default.delete(id);
- return res.status(200).end();
- };
- }
-}
-exports.default = new UserController();
-//# sourceMappingURL=user.controller.js.map
\ No newline at end of file
diff --git a/lib/controllers/user.controller.js.map b/lib/controllers/user.controller.js.map
deleted file mode 100644
index d2585d7..0000000
--- a/lib/controllers/user.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controllers/user.controller.ts"],"names":[],"mappings":";;;;;AACA,qEAA4C;AAG5C,MAAM,cAAc;IAApB;QACS,WAAM,GAAG,KAAK,EAAE,CAAU,EAAE,GAAa,EAAE,EAAE;YAClD,MAAM,KAAK,GAAG,MAAM,mBAAQ,CAAC,MAAM,EAAE,CAAC;YACtC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC;QAEK,QAAG,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACjD,MAAM,IAAI,GAAU,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAClC,MAAM,mBAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACzB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;QAEK,WAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACpD,MAAM,IAAI,GAAU,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAClC,MAAM,mBAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;QAEK,WAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;YACpD,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,mBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC1B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,IAAI,cAAc,EAAE,CAAC"}
\ No newline at end of file
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index f399426..0000000
--- a/lib/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-require("./pre-start"); // Must be the first import
-const jet_logger_1 = __importDefault(require("jet-logger"));
-const EnvVars_1 = __importDefault(require("@src/constants/EnvVars"));
-const server_1 = __importDefault(require("./server"));
-// **** Run **** //
-const SERVER_START_MSG = ('Express server started on port: ' +
- EnvVars_1.default.Port.toString());
-server_1.default.listen(EnvVars_1.default.Port, () => jet_logger_1.default.info(SERVER_START_MSG));
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/lib/index.js.map b/lib/index.js.map
deleted file mode 100644
index 9562a51..0000000
--- a/lib/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,uBAAqB,CAAC,2BAA2B;AACjD,4DAAgC;AAEhC,qEAA6C;AAC7C,sDAA8B;AAG9B,mBAAmB;AAEnB,MAAM,gBAAgB,GAAG,CAAC,kCAAkC;IAC1D,iBAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE3B,gBAAM,CAAC,MAAM,CAAC,iBAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,oBAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/models/board.model.js b/lib/models/board.model.js
deleted file mode 100644
index 12e0238..0000000
--- a/lib/models/board.model.js
+++ /dev/null
@@ -1,48 +0,0 @@
-"use strict";
-// **** Variables **** //
-Object.defineProperty(exports, "__esModule", { value: true });
-const INVALID_CONSTRUCTOR_PARAM = 'nameOrObj arg must be a string or an object with the appropriate board keys.';
-// **** Functions **** //
-/**
- * Create new Board.
- */
-function new_(userId, name, description, createdAt, updatedAt, id) {
- const now = new Date().toISOString();
- return {
- id: (id !== null && id !== void 0 ? id : -1),
- userId: (userId !== null && userId !== void 0 ? userId : -1),
- name: (name !== null && name !== void 0 ? name : ''),
- description,
- createdAt: (createdAt !== null && createdAt !== void 0 ? createdAt : now),
- updatedAt: (updatedAt !== null && updatedAt !== void 0 ? updatedAt : now),
- };
-}
-/**
- * Get board instance from object.
- */
-function from(param) {
- if (!isBoard(param)) {
- throw new Error(INVALID_CONSTRUCTOR_PARAM);
- }
- const p = param;
- return new_(p.userId, p.name, p.description, p.createdAt, p.updatedAt, p.id);
-}
-/**
- * See if the param meets criteria to be a board.
- */
-function isBoard(arg) {
- return (!!arg &&
- typeof arg === 'object' &&
- 'id' in arg &&
- 'userId' in arg &&
- 'name' in arg &&
- 'createdAt' in arg &&
- 'updatedAt' in arg);
-}
-// **** Export default **** //
-exports.default = {
- new: new_,
- from,
- isBoard,
-};
-//# sourceMappingURL=board.model.js.map
\ No newline at end of file
diff --git a/lib/models/board.model.js.map b/lib/models/board.model.js.map
deleted file mode 100644
index 057e59f..0000000
--- a/lib/models/board.model.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"board.model.js","sourceRoot":"","sources":["../../src/models/board.model.ts"],"names":[],"mappings":";AAAA,yBAAyB;;AAEzB,MAAM,yBAAyB,GAAG,8EAA8E,CAAC;AAajH,yBAAyB;AAEzB;;GAEG;AACH,SAAS,IAAI,CACZ,MAAe,EACf,IAAa,EACb,WAAoB,EACpB,SAAkB,EAClB,SAAkB,EAClB,EAAW;IAEX,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO;QACN,EAAE,EAAE,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,CAAC,CAAC;QACd,MAAM,EAAE,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,CAAC,CAAC,CAAC;QACtB,IAAI,EAAE,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;QAClB,WAAW;QACX,SAAS,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;QAC7B,SAAS,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;KAC7B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,IAAI,CAAC,KAAa;IAC1B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,CAAC,GAAG,KAAe,CAAC;IAC1B,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,GAAY;IAC5B,OAAO,CACN,CAAC,CAAC,GAAG;QACL,OAAO,GAAG,KAAK,QAAQ;QACvB,IAAI,IAAI,GAAG;QACX,QAAQ,IAAI,GAAG;QACf,MAAM,IAAI,GAAG;QACb,WAAW,IAAI,GAAG;QAClB,WAAW,IAAI,GAAG,CAClB,CAAC;AACH,CAAC;AAED,8BAA8B;AAE9B,kBAAe;IACd,GAAG,EAAE,IAAI;IACT,IAAI;IACJ,OAAO;CACE,CAAC"}
\ No newline at end of file
diff --git a/lib/models/task.model.js b/lib/models/task.model.js
deleted file mode 100644
index a2d31bd..0000000
--- a/lib/models/task.model.js
+++ /dev/null
@@ -1,50 +0,0 @@
-"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
\ No newline at end of file
diff --git a/lib/models/task.model.js.map b/lib/models/task.model.js.map
deleted file mode 100644
index 6bb99d4..0000000
--- a/lib/models/task.model.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"task.model.js","sourceRoot":"","sources":["../../src/models/task.model.ts"],"names":[],"mappings":";AAAA,yBAAyB;;AAEzB,MAAM,yBAAyB,GAAG,8EAA8E,CAAC;AAcjH,yBAAyB;AAEzB;;GAEG;AACH,SAAS,IAAI,CACZ,OAAgB,EAChB,KAAc,EACd,MAAwC,EACxC,WAAoB,EACpB,SAAkB,EAClB,SAAkB,EAClB,EAAW;IAEX,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO;QACN,EAAE,EAAE,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,CAAC,CAAC;QACd,OAAO,EAAE,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,CAAC,CAAC;QACxB,KAAK,EAAE,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;QACpB,MAAM,EAAE,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC;QAC1B,WAAW;QACX,SAAS,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;QAC7B,SAAS,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;KAC7B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,IAAI,CAAC,KAAa;IAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,CAAC,GAAG,KAAc,CAAC;IACzB,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,GAAY;IAC3B,OAAO,CACN,CAAC,CAAC,GAAG;QACL,OAAO,GAAG,KAAK,QAAQ;QACvB,IAAI,IAAI,GAAG;QACX,SAAS,IAAI,GAAG;QAChB,OAAO,IAAI,GAAG;QACd,QAAQ,IAAI,GAAG;QACf,WAAW,IAAI,GAAG;QAClB,WAAW,IAAI,GAAG,CAClB,CAAC;AACH,CAAC;AAED,8BAA8B;AAE9B,kBAAe;IACd,GAAG,EAAE,IAAI;IACT,IAAI;IACJ,MAAM;CACG,CAAC"}
\ No newline at end of file
diff --git a/lib/models/user.model.js b/lib/models/user.model.js
deleted file mode 100644
index c4b977d..0000000
--- a/lib/models/user.model.js
+++ /dev/null
@@ -1,54 +0,0 @@
-"use strict";
-// **** Variables **** //
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.UserRoles = void 0;
-const INVALID_CONSTRUCTOR_PARAM = 'nameOrObj arg must a string or an ' +
- 'object with the appropriate user keys.';
-var UserRoles;
-(function (UserRoles) {
- UserRoles[UserRoles["Standard"] = 0] = "Standard";
- UserRoles[UserRoles["Admin"] = 1] = "Admin";
-})(UserRoles || (exports.UserRoles = UserRoles = {}));
-// **** Functions **** //
-/**
- * Create new User.
- */
-function new_(name, email, role, pwdHash, id) {
- return {
- id: (id !== null && id !== void 0 ? id : -1),
- name: (name !== null && name !== void 0 ? name : ''),
- email: (email !== null && email !== void 0 ? email : ''),
- role: (role !== null && role !== void 0 ? role : UserRoles.Standard),
- pwdHash: (pwdHash !== null && pwdHash !== void 0 ? pwdHash : ''),
- };
-}
-/**
- * Get user instance from object.
- */
-function from(param) {
- // Check is user
- if (!isUser(param)) {
- throw new Error(INVALID_CONSTRUCTOR_PARAM);
- }
- // Get user instance
- const p = param;
- return new_(p.name, p.email, p.role, p.pwdHash, p.id);
-}
-/**
- * See if the param meets criteria to be a user.
- */
-function isUser(arg) {
- return (!!arg &&
- typeof arg === 'object' &&
- 'id' in arg &&
- 'email' in arg &&
- 'name' in arg &&
- 'role' in arg);
-}
-// **** Export default **** //
-exports.default = {
- new: new_,
- from,
- isUser,
-};
-//# sourceMappingURL=user.model.js.map
\ No newline at end of file
diff --git a/lib/models/user.model.js.map b/lib/models/user.model.js.map
deleted file mode 100644
index e57bffe..0000000
--- a/lib/models/user.model.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"user.model.js","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":";AAAA,yBAAyB;;;AAEzB,MAAM,yBAAyB,GAAG,oCAAoC;IACpE,wCAAwC,CAAC;AAE3C,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,iDAAQ,CAAA;IACR,2CAAK,CAAA;AACP,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAqBD,yBAAyB;AAEzB;;GAEG;AACH,SAAS,IAAI,CACX,IAAa,EACb,KAAc,EACd,IAAgB,EAChB,OAAgB,EAChB,EAAW;IAEX,OAAO;QACL,EAAE,EAAE,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,CAAC,CAAC;QACd,IAAI,EAAE,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;QAClB,KAAK,EAAE,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;QACpB,IAAI,EAAE,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS,CAAC,QAAQ,CAAC;QAClC,OAAO,EAAE,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;KACzB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,IAAI,CAAC,KAAa;IACzB,gBAAgB;IAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,oBAAoB;IACpB,MAAM,CAAC,GAAG,KAAc,CAAC;IACzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,GAAY;IAC1B,OAAO,CACL,CAAC,CAAC,GAAG;QACL,OAAO,GAAG,KAAK,QAAQ;QACvB,IAAI,IAAI,GAAG;QACX,OAAO,IAAI,GAAG;QACd,MAAM,IAAI,GAAG;QACb,MAAM,IAAI,GAAG,CACd,CAAC;AACJ,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,GAAG,EAAE,IAAI;IACT,IAAI;IACJ,MAAM;CACE,CAAC"}
\ No newline at end of file
diff --git a/lib/other/classes.js b/lib/other/classes.js
deleted file mode 100644
index adca176..0000000
--- a/lib/other/classes.js
+++ /dev/null
@@ -1,17 +0,0 @@
-"use strict";
-/**
- * Miscellaneous shared classes go here.
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.RouteError = void 0;
-/**
- * Error with status code and message
- */
-class RouteError extends Error {
- constructor(status, message) {
- super(message);
- this.status = status;
- }
-}
-exports.RouteError = RouteError;
-//# sourceMappingURL=classes.js.map
\ No newline at end of file
diff --git a/lib/other/classes.js.map b/lib/other/classes.js.map
deleted file mode 100644
index 2e5e091..0000000
--- a/lib/other/classes.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"classes.js","sourceRoot":"","sources":["../../src/other/classes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAKH;;GAEG;AACH,MAAa,UAAW,SAAQ,KAAK;IAEnC,YAAY,MAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAND,gCAMC"}
\ No newline at end of file
diff --git a/lib/other/types.js b/lib/other/types.js
deleted file mode 100644
index 11e638d..0000000
--- a/lib/other/types.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-//# sourceMappingURL=types.js.map
\ No newline at end of file
diff --git a/lib/other/types.js.map b/lib/other/types.js.map
deleted file mode 100644
index 543f832..0000000
--- a/lib/other/types.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/other/types.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/lib/pre-start.js b/lib/pre-start.js
deleted file mode 100644
index 4dd85b6..0000000
--- a/lib/pre-start.js
+++ /dev/null
@@ -1,31 +0,0 @@
-"use strict";
-/**
- * Pre-start is where we want to place things that must run BEFORE the express
- * server is started. This is useful for environment variables, command-line
- * arguments, and cron-jobs.
- */
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-// NOTE: DO NOT IMPORT ANY SOURCE CODE HERE
-const path_1 = __importDefault(require("path"));
-const dotenv_1 = __importDefault(require("dotenv"));
-const ts_command_line_args_1 = require("ts-command-line-args");
-// **** Setup **** //
-// Command line arguments
-const args = (0, ts_command_line_args_1.parse)({
- env: {
- type: String,
- defaultValue: 'development',
- alias: 'e',
- },
-});
-// Set the env file
-const result2 = dotenv_1.default.config({
- path: path_1.default.join(__dirname, `../env/${args.env}.env`),
-});
-if (result2.error) {
- throw result2.error;
-}
-//# sourceMappingURL=pre-start.js.map
\ No newline at end of file
diff --git a/lib/pre-start.js.map b/lib/pre-start.js.map
deleted file mode 100644
index 8bc6b66..0000000
--- a/lib/pre-start.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"pre-start.js","sourceRoot":"","sources":["../src/pre-start.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,2CAA2C;AAC3C,gDAAwB;AACxB,oDAA4B;AAC5B,+DAA6C;AAU7C,qBAAqB;AAErB,yBAAyB;AACzB,MAAM,IAAI,GAAG,IAAA,4BAAK,EAAQ;IACxB,GAAG,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,aAAa;QAC3B,KAAK,EAAE,GAAG;KACX;CACF,CAAC,CAAC;AAEH,mBAAmB;AACnB,MAAM,OAAO,GAAG,gBAAM,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,IAAI,CAAC,GAAG,MAAM,CAAC;CACrD,CAAC,CAAC;AACH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,MAAM,OAAO,CAAC,KAAK,CAAC;AACtB,CAAC"}
\ No newline at end of file
diff --git a/lib/public/scripts/http.js b/lib/public/scripts/http.js
deleted file mode 100644
index 799f8aa..0000000
--- a/lib/public/scripts/http.js
+++ /dev/null
@@ -1,27 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-var Http = (() => {
- // Setup request for json
- var getOptions = (verb, data) => {
- var options = {
- dataType: 'json',
- method: verb,
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- },
- };
- if (data) {
- options.body = JSON.stringify(data);
- }
- return options;
- };
- // Set Http methods
- return {
- get: (path) => fetch(path, getOptions('GET')),
- post: (path, data) => fetch(path, getOptions('POST', data)),
- put: (path, data) => fetch(path, getOptions('PUT', data)),
- delete: (path) => fetch(path, getOptions('DELETE')),
- };
-})();
-//# sourceMappingURL=http.js.map
\ No newline at end of file
diff --git a/lib/public/scripts/http.js.map b/lib/public/scripts/http.js.map
deleted file mode 100644
index 088257d..0000000
--- a/lib/public/scripts/http.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/public/scripts/http.js"],"names":[],"mappings":";;AAAA,IAAI,IAAI,GAAG,CAAC,GAAG,EAAE;IACf,yBAAyB;IACzB,IAAI,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI,OAAO,GAAG;YACZ,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,QAAQ,EAAE,kBAAkB;gBAC5B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC;QACF,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IACF,mBAAmB;IACnB,OAAO;QACL,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3D,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACzD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
\ No newline at end of file
diff --git a/lib/public/scripts/users.js b/lib/public/scripts/users.js
deleted file mode 100644
index 790b41c..0000000
--- a/lib/public/scripts/users.js
+++ /dev/null
@@ -1,154 +0,0 @@
-"use strict";
-// ***** Start **** //
-Object.defineProperty(exports, "__esModule", { value: true });
-displayUsers();
-// ***** Fetch and display users **** //
-/**
- * Call api
- */
-function displayUsers() {
- Http
- .get('/api/users/all')
- .then(resp => resp.json())
- .then((resp) => {
- var allUsers = resp.users;
- // Empty the anchor
- var allUsersAnchor = document.getElementById('all-users-anchor');
- allUsersAnchor.innerHTML = '';
- // Append users to anchor
- allUsers.forEach((user) => {
- allUsersAnchor.innerHTML += getUserDisplayEle(user);
- });
- });
-}
-/**
- * Get user display element
- */
-function getUserDisplayEle(user) {
- return (`
-
-
-
Name: ${user.name}
-
Email: ${user.email}
-
-
-
-
-
-
- Name:
-
-
- Email:
-
-
-
-
-
`);
-}
-// **** Add, Edit, and Delete Users **** //
-// Setup event listener for button click
-document.addEventListener('click', function (event) {
- event.preventDefault();
- var ele = event.target;
- if (ele.matches('#add-user-btn')) {
- addUser();
- }
- else if (ele.matches('.edit-user-btn')) {
- showEditView(ele.parentNode.parentNode);
- }
- else if (ele.matches('.cancel-edit-btn')) {
- cancelEdit(ele.parentNode.parentNode);
- }
- else if (ele.matches('.submit-edit-btn')) {
- submitEdit(ele);
- }
- else if (ele.matches('.delete-user-btn')) {
- deleteUser(ele);
- }
- else if (ele.matches('#logout-btn')) {
- logoutUser();
- }
-}, false);
-/**
- * Add a new user.
- */
-function addUser() {
- var nameInput = document.getElementById('name-input');
- var emailInput = document.getElementById('email-input');
- var data = {
- user: {
- id: -1,
- name: nameInput.value,
- email: emailInput.value,
- role: 0,
- },
- };
- // Call api
- Http
- .post('/api/users/add', data)
- .then(() => displayUsers());
-}
-/**
- * Show edit view.
- */
-function showEditView(userEle) {
- var normalView = userEle.getElementsByClassName('normal-view')[0];
- var editView = userEle.getElementsByClassName('edit-view')[0];
- normalView.style.display = 'none';
- editView.style.display = 'block';
-}
-/**
- * Cancel edit.
- */
-function cancelEdit(userEle) {
- var normalView = userEle.getElementsByClassName('normal-view')[0];
- var editView = userEle.getElementsByClassName('edit-view')[0];
- normalView.style.display = 'block';
- editView.style.display = 'none';
-}
-/**
- * Submit edit.
- */
-function submitEdit(ele) {
- var userEle = ele.parentNode.parentNode;
- var nameInput = userEle.getElementsByClassName('name-edit-input')[0];
- var emailInput = userEle.getElementsByClassName('email-edit-input')[0];
- var id = ele.getAttribute('data-user-id');
- var role = ele.getAttribute('data-user-role');
- var data = {
- user: {
- id: Number(id),
- name: nameInput.value,
- email: emailInput.value,
- role: Number(role),
- },
- };
- Http
- .put('/api/users/update', data)
- .then(() => displayUsers());
-}
-/**
- * Delete a user
- */
-function deleteUser(ele) {
- var id = ele.getAttribute('data-user-id');
- Http
- .delete('/api/users/delete/' + id)
- .then(() => displayUsers());
-}
-// **** Logout **** //
-function logoutUser() {
- Http
- .get('/api/auth/logout')
- .then(() => window.location.href = '/');
-}
-//# sourceMappingURL=users.js.map
\ No newline at end of file
diff --git a/lib/public/scripts/users.js.map b/lib/public/scripts/users.js.map
deleted file mode 100644
index f1edf65..0000000
--- a/lib/public/scripts/users.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/public/scripts/users.js"],"names":[],"mappings":";AAAA,sBAAsB;;AAEtB,YAAY,EAAE,CAAC;AAGf,wCAAwC;AAExC;;GAEG;AACH,SAAS,YAAY;IACnB,IAAI;SACD,GAAG,CAAC,gBAAgB,CAAC;SACrB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,mBAAmB;QACnB,IAAI,cAAc,GAAG,QAAQ,CAAC,cA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AAI;SACD,GAAG,CAAC,kBAAkB,CAAC;SACvB,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAC5C,CAAC"}
\ No newline at end of file
diff --git a/lib/repos/BoardRepo.js b/lib/repos/BoardRepo.js
deleted file mode 100644
index 47dfab5..0000000
--- a/lib/repos/BoardRepo.js
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const MockOrm_1 = __importDefault(require("./MockOrm"));
-async function getBoardsByUserId(userId) {
- const db = await MockOrm_1.default.openDb();
- return db.boards.filter((board) => board.userId === userId);
-}
-async function getBoardByUserId(userId, boardId) {
- const db = await MockOrm_1.default.openDb();
- return db.boards.find((board) => board.userId === userId && board.id === boardId) || null;
-}
-async function createBoard(userId, board) {
- const db = await MockOrm_1.default.openDb();
- board.id = Date.now();
- board.userId = userId;
- board.createdAt = new Date().toISOString();
- board.updatedAt = board.createdAt;
- db.boards.push(board);
- await MockOrm_1.default.saveDb(db);
- return board;
-}
-async function updateBoard(userId, boardId, boardData) {
- const db = await MockOrm_1.default.openDb();
- const board = db.boards.find((b) => b.userId === userId && b.id === boardId);
- if (board) {
- Object.assign(board, boardData, { updatedAt: new Date().toISOString() });
- await MockOrm_1.default.saveDb(db);
- return board;
- }
- return null;
-}
-async function deleteBoard(userId, boardId) {
- const db = await MockOrm_1.default.openDb();
- const idx = db.boards.findIndex((b) => b.userId === userId && b.id === boardId);
- if (idx !== -1) {
- db.boards.splice(idx, 1);
- await MockOrm_1.default.saveDb(db);
- return true;
- }
- return false;
-}
-exports.default = {
- getBoardsByUserId,
- getBoardByUserId,
- createBoard,
- updateBoard,
- deleteBoard,
-};
-//# sourceMappingURL=BoardRepo.js.map
\ No newline at end of file
diff --git a/lib/repos/BoardRepo.js.map b/lib/repos/BoardRepo.js.map
deleted file mode 100644
index 3e73e3b..0000000
--- a/lib/repos/BoardRepo.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"BoardRepo.js","sourceRoot":"","sources":["../../src/repos/BoardRepo.ts"],"names":[],"mappings":";;;;;AACA,wDAA4B;AAE5B,KAAK,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AACrE,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAe;IAC9D,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,CAAC,IAAI,IAAI,CAAC;AACnG,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,KAAa;IACvD,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAClC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,MAAM,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrB,OAAO,KAAK,CAAC;AACd,CAAC;AAED,KAAK,UAAU,WAAW,CAA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
--- a/lib/repos/MockOrm.js
+++ /dev/null
@@ -1,27 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const jsonfile_1 = __importDefault(require("jsonfile"));
-// **** Variables **** //
-const DB_FILE_NAME = 'database.json';
-// **** Functions **** //
-/**
- * Fetch the json from the file.
- */
-function openDb() {
- return jsonfile_1.default.readFile(__dirname + '/' + DB_FILE_NAME);
-}
-/**
- * Update the file.
- */
-function saveDb(db) {
- return jsonfile_1.default.writeFile((__dirname + '/' + DB_FILE_NAME), db);
-}
-// **** Export default **** //
-exports.default = {
- openDb,
- saveDb,
-};
-//# sourceMappingURL=MockOrm.js.map
\ No newline at end of file
diff --git a/lib/repos/MockOrm.js.map b/lib/repos/MockOrm.js.map
deleted file mode 100644
index 759649a..0000000
--- a/lib/repos/MockOrm.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"MockOrm.js","sourceRoot":"","sources":["../../src/repos/MockOrm.ts"],"names":[],"mappings":";;;;;AAEA,wDAAgC;AAOhC,yBAAyB;AAEzB,MAAM,YAAY,GAAG,eAAe,CAAC;AAYrC,yBAAyB;AAEzB;;GAEG;AACH,SAAS,MAAM;IACb,OAAO,kBAAQ,CAAC,QAAQ,CAAC,SAAS,GAAG,GAAG,GAAG,YAAY,CAAiB,CAAC;AAC3E,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,EAAO;IACrB,OAAO,kBAAQ,CAAC,SAAS,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,MAAM;IACN,MAAM;CACE,CAAC"}
\ No newline at end of file
diff --git a/lib/repos/TaskRepo.js b/lib/repos/TaskRepo.js
deleted file mode 100644
index a5bd8a5..0000000
--- a/lib/repos/TaskRepo.js
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const MockOrm_1 = __importDefault(require("./MockOrm"));
-async function getTasksByBoardId(boardId) {
- const db = await MockOrm_1.default.openDb();
- return db.tasks.filter((task) => task.boardId === boardId);
-}
-async function getTaskByBoardId(boardId, taskId) {
- const db = await MockOrm_1.default.openDb();
- return db.tasks.find((task) => task.boardId === boardId && task.id === taskId) || null;
-}
-async function createTask(boardId, task) {
- const db = await MockOrm_1.default.openDb();
- task.id = Date.now();
- task.boardId = boardId;
- task.createdAt = new Date().toISOString();
- task.updatedAt = task.createdAt;
- db.tasks.push(task);
- await MockOrm_1.default.saveDb(db);
- return task;
-}
-async function updateTask(boardId, taskId, taskData) {
- const db = await MockOrm_1.default.openDb();
- const task = db.tasks.find((t) => t.boardId === boardId && t.id === taskId);
- if (task) {
- Object.assign(task, taskData, { updatedAt: new Date().toISOString() });
- await MockOrm_1.default.saveDb(db);
- return task;
- }
- return null;
-}
-async function deleteTask(boardId, taskId) {
- const db = await MockOrm_1.default.openDb();
- const idx = db.tasks.findIndex((t) => t.boardId === boardId && t.id === taskId);
- if (idx !== -1) {
- db.tasks.splice(idx, 1);
- await MockOrm_1.default.saveDb(db);
- return true;
- }
- return false;
-}
-exports.default = {
- getTasksByBoardId,
- getTaskByBoardId,
- createTask,
- updateTask,
- deleteTask,
-};
-//# sourceMappingURL=TaskRepo.js.map
\ No newline at end of file
diff --git a/lib/repos/TaskRepo.js.map b/lib/repos/TaskRepo.js.map
deleted file mode 100644
index 2c42ba7..0000000
--- a/lib/repos/TaskRepo.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"TaskRepo.js","sourceRoot":"","sources":["../../src/repos/TaskRepo.ts"],"names":[],"mappings":";;;;;AACA,wDAA4B;AAE5B,KAAK,UAAU,iBAAiB,CAAC,OAAe;IAC/C,M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C,EAAE,KAAK,MAAM,CAAC,CAAC;IACnF,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACvE,MAAM,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,MAAc;IACxD,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IACvF,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QAChB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACxB,MAAM,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kBAAe;IACd,iBAAiB;IACjB,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;CACV,CAAC"}
\ No newline at end of file
diff --git a/lib/repos/board.repo.js b/lib/repos/board.repo.js
deleted file mode 100644
index 5996ec3..0000000
--- a/lib/repos/board.repo.js
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const MockOrm_1 = __importDefault(require("./MockOrm"));
-async function getBoardsByUserId(userId) {
- const db = await MockOrm_1.default.openDb();
- return db.boards.filter((board) => board.userId === userId);
-}
-async function getBoardByUserId(userId, boardId) {
- const db = await MockOrm_1.default.openDb();
- return db.boards.find((board) => board.userId === userId && board.id === boardId) || null;
-}
-async function createBoard(userId, board) {
- const db = await MockOrm_1.default.openDb();
- board.id = Date.now();
- board.userId = userId;
- board.createdAt = new Date().toISOString();
- board.updatedAt = board.createdAt;
- db.boards.push(board);
- await MockOrm_1.default.saveDb(db);
- return board;
-}
-async function updateBoard(userId, boardId, boardData) {
- const db = await MockOrm_1.default.openDb();
- const board = db.boards.find((b) => b.userId === userId && b.id === boardId);
- if (board) {
- Object.assign(board, boardData, { updatedAt: new Date().toISOString() });
- await MockOrm_1.default.saveDb(db);
- return board;
- }
- return null;
-}
-async function deleteBoard(userId, boardId) {
- const db = await MockOrm_1.default.openDb();
- const idx = db.boards.findIndex((b) => b.userId === userId && b.id === boardId);
- if (idx !== -1) {
- db.boards.splice(idx, 1);
- await MockOrm_1.default.saveDb(db);
- return true;
- }
- return false;
-}
-exports.default = {
- getBoardsByUserId,
- getBoardByUserId,
- createBoard,
- updateBoard,
- deleteBoard,
-};
-//# sourceMappingURL=board.repo.js.map
\ No newline at end of file
diff --git a/lib/repos/board.repo.js.map b/lib/repos/board.repo.js.map
deleted file mode 100644
index 7e0c263..0000000
--- a/lib/repos/board.repo.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"board.repo.js","sourceRoot":"","sources":["../../src/repos/board.repo.ts"],"names":[],"mappings":";;;;;AACA,wDAA4B;AAE5B,KAAK,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AACrE,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAe;IAC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QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,OAAe;IACzD,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IACxF,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QAChB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACzB,MAAM,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kBAAe;IACd,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,WAAW;CACX,CAAC"}
\ No newline at end of file
diff --git a/lib/repos/task.repo.js b/lib/repos/task.repo.js
deleted file mode 100644
index a883bf0..0000000
--- a/lib/repos/task.repo.js
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const MockOrm_1 = __importDefault(require("./MockOrm"));
-async function getTasksByBoardId(boardId) {
- const db = await MockOrm_1.default.openDb();
- return db.tasks.filter((task) => task.boardId === boardId);
-}
-async function getTaskByBoardId(boardId, taskId) {
- const db = await MockOrm_1.default.openDb();
- return db.tasks.find((task) => task.boardId === boardId && task.id === taskId) || null;
-}
-async function createTask(boardId, task) {
- const db = await MockOrm_1.default.openDb();
- task.id = Date.now();
- task.boardId = boardId;
- task.createdAt = new Date().toISOString();
- task.updatedAt = task.createdAt;
- db.tasks.push(task);
- await MockOrm_1.default.saveDb(db);
- return task;
-}
-async function updateTask(boardId, taskId, taskData) {
- const db = await MockOrm_1.default.openDb();
- const task = db.tasks.find((t) => t.boardId === boardId && t.id === taskId);
- if (task) {
- Object.assign(task, taskData, { updatedAt: new Date().toISOString() });
- await MockOrm_1.default.saveDb(db);
- return task;
- }
- return null;
-}
-async function deleteTask(boardId, taskId) {
- const db = await MockOrm_1.default.openDb();
- const idx = db.tasks.findIndex((t) => t.boardId === boardId && t.id === taskId);
- if (idx !== -1) {
- db.tasks.splice(idx, 1);
- await MockOrm_1.default.saveDb(db);
- return true;
- }
- return false;
-}
-exports.default = {
- getTasksByBoardId,
- getTaskByBoardId,
- createTask,
- updateTask,
- deleteTask,
-};
-//# sourceMappingURL=task.repo.js.map
\ No newline at end of file
diff --git a/lib/repos/task.repo.js.map b/lib/repos/task.repo.js.map
deleted file mode 100644
index 8eb9207..0000000
--- a/lib/repos/task.repo.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"task.repo.js","sourceRoot":"","sources":["../../src/repos/task.repo.ts"],"names":[],"mappings":";;;;;AACA,wDAA4B;AAE5B,KAAK,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAc;IAC9D,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,IAAI,IAAI,CAA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AC,SAAS,CAAC,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IACvF,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QAChB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACxB,MAAM,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kBAAe;IACd,iBAAiB;IACjB,gBAAgB;IAChB,UAAU;IACV,UAAU;IACV,UAAU;CACV,CAAC"}
\ No newline at end of file
diff --git a/lib/repos/user.repo.js b/lib/repos/user.repo.js
deleted file mode 100644
index b3c84a8..0000000
--- a/lib/repos/user.repo.js
+++ /dev/null
@@ -1,82 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const misc_1 = require("@src/util/misc");
-const MockOrm_1 = __importDefault(require("./MockOrm"));
-// **** Functions **** //
-/**
- * Get one user.
- */
-async function getOne(email) {
- const db = await MockOrm_1.default.openDb();
- for (const user of db.users) {
- if (user.email === email) {
- return user;
- }
- }
- return null;
-}
-/**
- * See if a user with the given id exists.
- */
-async function persists(id) {
- const db = await MockOrm_1.default.openDb();
- for (const user of db.users) {
- if (user.id === id) {
- return true;
- }
- }
- return false;
-}
-/**
- * Get all users.
- */
-async function getAll() {
- const db = await MockOrm_1.default.openDb();
- return db.users;
-}
-/**
- * Add one user.
- */
-async function add(user) {
- const db = await MockOrm_1.default.openDb();
- user.id = (0, misc_1.getRandomInt)();
- db.users.push(user);
- return MockOrm_1.default.saveDb(db);
-}
-/**
- * Update a user.
- */
-async function update(user) {
- const db = await MockOrm_1.default.openDb();
- for (let i = 0; i < db.users.length; i++) {
- if (db.users[i].id === user.id) {
- db.users[i] = user;
- return MockOrm_1.default.saveDb(db);
- }
- }
-}
-/**
- * Delete one user.
- */
-async function delete_(id) {
- const db = await MockOrm_1.default.openDb();
- for (let i = 0; i < db.users.length; i++) {
- if (db.users[i].id === id) {
- db.users.splice(i, 1);
- return MockOrm_1.default.saveDb(db);
- }
- }
-}
-// **** Export default **** //
-exports.default = {
- getOne,
- persists,
- getAll,
- add,
- update,
- delete: delete_,
-};
-//# sourceMappingURL=user.repo.js.map
\ No newline at end of file
diff --git a/lib/repos/user.repo.js.map b/lib/repos/user.repo.js.map
deleted file mode 100644
index 3621f77..0000000
--- a/lib/repos/user.repo.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"user.repo.js","sourceRoot":"","sources":["../../src/repos/user.repo.ts"],"names":[],"mappings":";;;;;AACA,yCAA8C;AAC9C,wDAA4B;AAG5B,yBAAyB;AAEzB;;GAEG;AACH,KAAK,UAAU,MAAM,CAAC,KAAa;IACjC,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,QAAQ,CAAC,EAAU;IAChC,MAAM,EAAE,GAAG,MAAM,iBAAG,CAAC,MAAM,EAAE,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,MAAM;IACnB,MA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CAAC,CAAC,CAAC;YACtB,OAAO,iBAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,MAAM;IACN,QAAQ;IACR,MAAM;IACN,GAAG;IACH,MAAM;IACN,MAAM,EAAE,OAAO;CACP,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/api.js b/lib/routes/api.js
deleted file mode 100644
index af997c7..0000000
--- a/lib/routes/api.js
+++ /dev/null
@@ -1,24 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const express_1 = require("express");
-const jet_validator_1 = __importDefault(require("jet-validator"));
-const Paths_1 = __importDefault(require("./constants/Paths"));
-const user_model_1 = __importDefault(require("@src/models/user.model"));
-const user_controller_1 = __importDefault(require("@src/controllers/user.controller"));
-// **** Variables **** //
-const apiRouter = (0, express_1.Router)(), validate = (0, jet_validator_1.default)();
-// ** Add UserRouter ** //
-const userRouter = (0, express_1.Router)();
-// Get all users
-userRouter.get(Paths_1.default.Users.Get, user_controller_1.default.getAll.bind(user_controller_1.default));
-userRouter.post(Paths_1.default.Users.Add, validate(['user', user_model_1.default.isUser]), user_controller_1.default.add.bind(user_controller_1.default));
-userRouter.put(Paths_1.default.Users.Update, validate(['user', user_model_1.default.isUser]), user_controller_1.default.update.bind(user_controller_1.default));
-userRouter.delete(Paths_1.default.Users.Delete, validate(['id', 'number', 'params']), user_controller_1.default.delete.bind(user_controller_1.default));
-// Add UserRouter
-apiRouter.use(Paths_1.default.Users.Base, userRouter);
-// **** Export default **** //
-exports.default = apiRouter;
-//# sourceMappingURL=api.js.map
\ No newline at end of file
diff --git a/lib/routes/api.js.map b/lib/routes/api.js.map
deleted file mode 100644
index 85f4d1c..0000000
--- a/lib/routes/api.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/routes/api.ts"],"names":[],"mappings":";;;;;AAAA,qCAAiC;AACjC,kEAAyC;AAEzC,8DAAsC;AACtC,wEAA0C;AAC1C,uFAA8D;AAG9D,yBAAyB;AAEzB,MAAM,SAAS,GAAG,IAAA,gBAAM,GAAE,EACxB,QAAQ,GAAG,IAAA,uBAAY,GAAE,CAAC;AAG5B,0BAA0B;AAE1B,MAAM,UAAU,GAAG,IAAA,gBAAM,GAAE,CAAC;AAE5B,gBAAgB;AAChB,UAAU,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,EAAE,yBAAc,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAc,CAAC,CAAC,CAAC;AAC5E,UAAU,CAAC,IAAI,CACb,eAAK,CAAC,KAAK,CAAC,GAAG,EACf,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAI,CAAC,MAAM,CAAC,CAAC,EAC/B,yBAAc,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAc,CAAC,CACxC,CAAC;AACF,UAAU,CAAC,GAAG,CACZ,eAAK,CAAC,KAAK,CAAC,MAAM,EAClB,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAI,CAAC,MAAM,CAAC,CAAC,EAC/B,yBAAc,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAc,CAAC,CAC3C,CAAC;AACF,UAAU,CAAC,MAAM,CACf,eAAK,CAAC,KAAK,CAAC,MAAM,EAClB,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,EACpC,yBAAc,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAc,CAAC,CAC3C,CAAC;AAEF,iBAAiB;AACjB,SAAS,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAG5C,8BAA8B;AAE9B,kBAAe,SAAS,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/board.route.js b/lib/routes/board.route.js
deleted file mode 100644
index fb27424..0000000
--- a/lib/routes/board.route.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const express_1 = require("express");
-const board_controller_1 = __importDefault(require("../controllers/board.controller"));
-const router = (0, express_1.Router)();
-router.get('/user/:userId', board_controller_1.default.getBoardsByUserId);
-router.get('/user/:userId/:boardId', board_controller_1.default.getBoardByUserId);
-router.post('/user/:userId', board_controller_1.default.createBoard);
-router.put('/user/:userId/:boardId', board_controller_1.default.updateBoard);
-router.delete('/user/:userId/:boardId', board_controller_1.default.deleteBoard);
-exports.default = router;
-//# sourceMappingURL=board.route.js.map
\ No newline at end of file
diff --git a/lib/routes/board.route.js.map b/lib/routes/board.route.js.map
deleted file mode 100644
index cb43a6c..0000000
--- a/lib/routes/board.route.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"board.route.js","sourceRoot":"","sources":["../../src/routes/board.route.ts"],"names":[],"mappings":";;;;;AACA,qCAAiC;AACjC,uFAA8D;AAE9D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,0BAAe,CAAC,iBAAiB,CAAC,CAAC;AAC/D,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,0BAAe,CAAC,gBAAgB,CAAC,CAAC;AACvE,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,0BAAe,CAAC,WAAW,CAAC,CAAC;AAC1D,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,0BAAe,CAAC,WAAW,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE,0BAAe,CAAC,WAAW,CAAC,CAAC;AAErE,kBAAe,MAAM,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/constants/FullPaths.js b/lib/routes/constants/FullPaths.js
deleted file mode 100644
index 3a4d54a..0000000
--- a/lib/routes/constants/FullPaths.js
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-/**
- * Convert paths to full paths.
- */
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const Paths_1 = __importDefault(require("./Paths"));
-/**
- * The recursive function.
- */
-function getFullPaths(parent, baseUrl) {
- const url = (baseUrl + parent.Base), keys = Object.keys(parent), retVal = { Base: url };
- // Iterate keys
- for (const key of keys) {
- const pval = parent[key];
- if (key !== 'Base' && typeof pval === 'string') {
- retVal[key] = (url + pval);
- }
- else if (typeof pval === 'object') {
- retVal[key] = getFullPaths(pval, url);
- }
- }
- // Return
- return retVal;
-}
-// **** Export default **** //
-exports.default = getFullPaths(Paths_1.default, '');
-//# sourceMappingURL=FullPaths.js.map
\ No newline at end of file
diff --git a/lib/routes/constants/FullPaths.js.map b/lib/routes/constants/FullPaths.js.map
deleted file mode 100644
index c56fa5c..0000000
--- a/lib/routes/constants/FullPaths.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"FullPaths.js","sourceRoot":"","sources":["../../../src/routes/constants/FullPaths.ts"],"names":[],"mappings":";AACA;;GAEG;;;;;AAEH,oDAAwC;AAQxC;;GAEG;AACH,SAAS,YAAY,CACnB,MAAgB,EAChB,OAAe;IAEf,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EACjC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1B,MAAM,GAAa,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACnC,eAAe;IACf,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,GAAG,KAAK,MAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC7B,CAAC;aAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACpC,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IACD,SAAS;IACT,OAAO,MAAM,CAAC;AAChB,CAAC;AAGD,8BAA8B;AAE9B,kBAAe,YAAY,CAAC,eAAK,EAAE,EAAE,CAAW,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/constants/Paths.js b/lib/routes/constants/Paths.js
deleted file mode 100644
index 2d3b5d4..0000000
--- a/lib/routes/constants/Paths.js
+++ /dev/null
@@ -1,17 +0,0 @@
-"use strict";
-/**
- * Express router paths go here.
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-const Paths = {
- Base: '/api',
- Users: {
- Base: '/users',
- Get: '/all',
- Add: '/add',
- Update: '/update',
- Delete: '/delete/:id',
- },
-};
-exports.default = Paths;
-//# sourceMappingURL=Paths.js.map
\ No newline at end of file
diff --git a/lib/routes/constants/Paths.js.map b/lib/routes/constants/Paths.js.map
deleted file mode 100644
index e0a24da..0000000
--- a/lib/routes/constants/Paths.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Paths.js","sourceRoot":"","sources":["../../../src/routes/constants/Paths.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAKH,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,aAAa;KACtB;CACF,CAAC;AAMF,kBAAe,KAAe,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/task.route.js b/lib/routes/task.route.js
deleted file mode 100644
index 6fbc8be..0000000
--- a/lib/routes/task.route.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const express_1 = require("express");
-const task_controller_1 = __importDefault(require("../controllers/task.controller"));
-const router = (0, express_1.Router)();
-router.get('/board/:boardId', task_controller_1.default.getTasksByBoardId);
-router.get('/board/:boardId/:taskId', task_controller_1.default.getTaskByBoardId);
-router.post('/board/:boardId', task_controller_1.default.createTask);
-router.put('/board/:boardId/:taskId', task_controller_1.default.updateTask);
-router.delete('/board/:boardId/:taskId', task_controller_1.default.deleteTask);
-exports.default = router;
-//# sourceMappingURL=task.route.js.map
\ No newline at end of file
diff --git a/lib/routes/task.route.js.map b/lib/routes/task.route.js.map
deleted file mode 100644
index aade63b..0000000
--- a/lib/routes/task.route.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"task.route.js","sourceRoot":"","sources":["../../src/routes/task.route.ts"],"names":[],"mappings":";;;;;AACA,qCAAiC;AACjC,qFAA4D;AAE5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,yBAAc,CAAC,iBAAiB,CAAC,CAAC;AAChE,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,yBAAc,CAAC,gBAAgB,CAAC,CAAC;AACvE,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,yBAAc,CAAC,UAAU,CAAC,CAAC;AAC1D,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,yBAAc,CAAC,UAAU,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,yBAAc,CAAC,UAAU,CAAC,CAAC;AAEpE,kBAAe,MAAM,CAAC"}
\ No newline at end of file
diff --git a/lib/routes/types/express/misc.js b/lib/routes/types/express/misc.js
deleted file mode 100644
index 5387908..0000000
--- a/lib/routes/types/express/misc.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-//# sourceMappingURL=misc.js.map
\ No newline at end of file
diff --git a/lib/routes/types/express/misc.js.map b/lib/routes/types/express/misc.js.map
deleted file mode 100644
index e3a9914..0000000
--- a/lib/routes/types/express/misc.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../../../src/routes/types/express/misc.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/lib/routes/types/types.js b/lib/routes/types/types.js
deleted file mode 100644
index 11e638d..0000000
--- a/lib/routes/types/types.js
+++ /dev/null
@@ -1,3 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-//# sourceMappingURL=types.js.map
\ No newline at end of file
diff --git a/lib/routes/types/types.js.map b/lib/routes/types/types.js.map
deleted file mode 100644
index 098515c..0000000
--- a/lib/routes/types/types.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/routes/types/types.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/lib/routes/user.route.js b/lib/routes/user.route.js
deleted file mode 100644
index 5d008d9..0000000
--- a/lib/routes/user.route.js
+++ /dev/null
@@ -1,14 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const express_1 = require("express");
-const user_controller_1 = __importDefault(require("../controllers/user.controller"));
-const router = (0, express_1.Router)();
-router.get('/', user_controller_1.default.getAll);
-router.post('/', user_controller_1.default.add);
-router.put('/', user_controller_1.default.update);
-router.delete('/:id', user_controller_1.default.delete);
-exports.default = router;
-//# sourceMappingURL=user.route.js.map
\ No newline at end of file
diff --git a/lib/routes/user.route.js.map b/lib/routes/user.route.js.map
deleted file mode 100644
index f962444..0000000
--- a/lib/routes/user.route.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"user.route.js","sourceRoot":"","sources":["../../src/routes/user.route.ts"],"names":[],"mappings":";;;;;AAAA,qCAAiC;AACjC,qFAA4D;AAE5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAc,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,yBAAc,CAAC,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAc,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAc,CAAC,MAAM,CAAC,CAAC;AAE7C,kBAAe,MAAM,CAAC"}
\ No newline at end of file
diff --git a/lib/server.js b/lib/server.js
deleted file mode 100644
index b33bf63..0000000
--- a/lib/server.js
+++ /dev/null
@@ -1,69 +0,0 @@
-"use strict";
-/**
- * Setup express server.
- */
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const cookie_parser_1 = __importDefault(require("cookie-parser"));
-const morgan_1 = __importDefault(require("morgan"));
-const path_1 = __importDefault(require("path"));
-const helmet_1 = __importDefault(require("helmet"));
-const express_1 = __importDefault(require("express"));
-const jet_logger_1 = __importDefault(require("jet-logger"));
-require("express-async-errors");
-const api_1 = __importDefault(require("@src/routes/api"));
-const Paths_1 = __importDefault(require("@src/routes/constants/Paths"));
-const EnvVars_1 = __importDefault(require("@src/constants/EnvVars"));
-const HttpStatusCodes_1 = __importDefault(require("@src/constants/HttpStatusCodes"));
-const misc_1 = require("@src/constants/misc");
-const classes_1 = require("@src/other/classes");
-// **** Variables **** //
-const app = (0, express_1.default)();
-// **** Setup **** //
-// Basic middleware
-app.use(express_1.default.json());
-app.use(express_1.default.urlencoded({ extended: true }));
-app.use((0, cookie_parser_1.default)(EnvVars_1.default.CookieProps.Secret));
-// Show routes called in console during development
-if (EnvVars_1.default.NodeEnv === misc_1.NodeEnvs.Dev) {
- app.use((0, morgan_1.default)('dev'));
-}
-// Security
-if (EnvVars_1.default.NodeEnv === misc_1.NodeEnvs.Production) {
- app.use((0, helmet_1.default)());
-}
-// Add APIs, must be after middleware
-app.use(Paths_1.default.Base, api_1.default);
-// Add error handler
-app.use((err, _, res,
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-next) => {
- if (EnvVars_1.default.NodeEnv !== misc_1.NodeEnvs.Test) {
- jet_logger_1.default.err(err, true);
- }
- let status = HttpStatusCodes_1.default.BAD_REQUEST;
- if (err instanceof classes_1.RouteError) {
- status = err.status;
- }
- return res.status(status).json({ error: err.message });
-});
-// ** Front-End Content ** //
-// Set views directory (html)
-const viewsDir = path_1.default.join(__dirname, 'views');
-app.set('views', viewsDir);
-// Set static directory (js and css).
-const staticDir = path_1.default.join(__dirname, 'public');
-app.use(express_1.default.static(staticDir));
-// Nav to users pg by default
-app.get('/', (_, res) => {
- return res.redirect('/users');
-});
-// Redirect to login if not logged in.
-app.get('/users', (_, res) => {
- return res.sendFile('users.html', { root: viewsDir });
-});
-// **** Export default **** //
-exports.default = app;
-//# sourceMappingURL=server.js.map
\ No newline at end of file
diff --git a/lib/server.js.map b/lib/server.js.map
deleted file mode 100644
index acfd2be..0000000
--- a/lib/server.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,kEAAyC;AACzC,oDAA4B;AAC5B,gDAAwB;AACxB,oDAA4B;AAC5B,sDAAmE;AACnE,4DAAgC;AAEhC,gCAA8B;AAE9B,0DAAyC;AACzC,wEAAgD;AAEhD,qEAA6C;AAC7C,qFAA6D;AAE7D,8CAA+C;AAC/C,gDAAgD;AAGhD,yBAAyB;AAEzB,MAAM,GAAG,GAAG,IAAA,i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,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC;AAGH,6BAA6B;AAE7B,6BAA6B;AAC7B,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE3B,qCAAqC;AACrC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACjD,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAEnC,6BAA6B;AAC7B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAU,EAAE,GAAa,EAAE,EAAE;IACzC,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEH,sCAAsC;AACtC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAU,EAAE,GAAa,EAAE,EAAE;IAC9C,OAAO,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAGH,8BAA8B;AAE9B,kBAAe,GAAG,CAAC"}
\ No newline at end of file
diff --git a/lib/services/AuthService.js b/lib/services/AuthService.js
deleted file mode 100644
index 033fab6..0000000
--- a/lib/services/AuthService.js
+++ /dev/null
@@ -1,45 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Errors = void 0;
-const user_repo_1 = __importDefault(require("@src/repos/user.repo"));
-const PwdUtil_1 = __importDefault(require("@src/util/PwdUtil"));
-const misc_1 = require("@src/util/misc");
-const HttpStatusCodes_1 = __importDefault(require("@src/constants/HttpStatusCodes"));
-const classes_1 = require("@src/other/classes");
-// **** Variables **** //
-// Errors
-exports.Errors = {
- Unauth: 'Unauthorized',
- EmailNotFound(email) {
- return `User with email "${email}" not found`;
- },
-};
-// **** Functions **** //
-/**
- * Login a user.
- */
-async function login(email, password) {
- var _a;
- // Fetch user
- const user = await user_repo_1.default.getOne(email);
- if (!user) {
- throw new classes_1.RouteError(HttpStatusCodes_1.default.UNAUTHORIZED, exports.Errors.EmailNotFound(email));
- }
- // Check password
- const hash = ((_a = user.pwdHash) !== null && _a !== void 0 ? _a : ''), pwdPassed = await PwdUtil_1.default.compare(password, hash);
- if (!pwdPassed) {
- // If password failed, wait 500ms this will increase security
- await (0, misc_1.tick)(500);
- throw new classes_1.RouteError(HttpStatusCodes_1.default.UNAUTHORIZED, exports.Errors.Unauth);
- }
- // Return
- return user;
-}
-// **** Export default **** //
-exports.default = {
- login,
-};
-//# sourceMappingURL=AuthService.js.map
\ No newline at end of file
diff --git a/lib/services/AuthService.js.map b/lib/services/AuthService.js.map
deleted file mode 100644
index 60c1e36..0000000
--- a/lib/services/AuthService.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../src/services/AuthService.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA4C;AAE5C,gEAAwC;AACxC,yCAAsC;AAEtC,qFAA6D;AAC7D,gDAAgD;AAIhD,yBAAyB;AAEzB,SAAS;AACI,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,cAAc;IACtB,aAAa,CAAC,KAAa;QACzB,OAAO,oBAAoB,KAAK,aAAa,CAAC;IAChD,CAAC;CACO,CAAC;AAGX,yBAAyB;AAEzB;;GAEG;AACH,KAAK,UAAU,KAAK,CAAC,KAAa,EAAE,QAAgB;;IAClD,aAAa;IACb,MAAM,IAAI,GAAG,MAAM,mBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,oBAAU,CAClB,yBAAe,CAAC,YAAY,EAC5B,cAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAC5B,CAAC;IACJ,CAAC;IACD,iBAAiB;IACjB,MAAM,IAAI,GAAG,CAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC,EAC/B,SAAS,GAAG,MAAM,iBAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACpD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,6DAA6D;QAC7D,MAAM,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC;QAChB,MAAM,IAAI,oBAAU,CAClB,yBAAe,CAAC,YAAY,EAC5B,cAAM,CAAC,MAAM,CACd,CAAC;IACJ,CAAC;IACD,SAAS;IACT,OAAO,IAAI,CAAC;AACd,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,KAAK;CACG,CAAC"}
\ No newline at end of file
diff --git a/lib/services/UserService.js b/lib/services/UserService.js
deleted file mode 100644
index 221771b..0000000
--- a/lib/services/UserService.js
+++ /dev/null
@@ -1,54 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.USER_NOT_FOUND_ERR = void 0;
-const user_repo_1 = __importDefault(require("@src/repos/user.repo"));
-const classes_1 = require("@src/other/classes");
-const HttpStatusCodes_1 = __importDefault(require("@src/constants/HttpStatusCodes"));
-// **** Variables **** //
-exports.USER_NOT_FOUND_ERR = 'User not found';
-// **** Functions **** //
-/**
- * Get all users.
- */
-function getAll() {
- return user_repo_1.default.getAll();
-}
-/**
- * Add one user.
- */
-function addOne(user) {
- return user_repo_1.default.add(user);
-}
-/**
- * Update one user.
- */
-async function updateOne(user) {
- const persists = await user_repo_1.default.persists(user.id);
- if (!persists) {
- throw new classes_1.RouteError(HttpStatusCodes_1.default.NOT_FOUND, exports.USER_NOT_FOUND_ERR);
- }
- // Return user
- return user_repo_1.default.update(user);
-}
-/**
- * Delete a user by their id.
- */
-async function _delete(id) {
- const persists = await user_repo_1.default.persists(id);
- if (!persists) {
- throw new classes_1.RouteError(HttpStatusCodes_1.default.NOT_FOUND, exports.USER_NOT_FOUND_ERR);
- }
- // Delete user
- return user_repo_1.default.delete(id);
-}
-// **** Export default **** //
-exports.default = {
- getAll,
- addOne,
- updateOne,
- delete: _delete,
-};
-//# sourceMappingURL=UserService.js.map
\ No newline at end of file
diff --git a/lib/services/UserService.js.map b/lib/services/UserService.js.map
deleted file mode 100644
index 16e4bde..0000000
--- a/lib/services/UserService.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../src/services/UserService.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA4C;AAE5C,gDAAgD;AAChD,qFAA6D;AAG7D,yBAAyB;AAEZ,QAAA,kBAAkB,GAAG,gBAAgB,CAAC;AAGnD,yBAAyB;AAEzB;;GAEG;AACH,SAAS,MAAM;IACb,OAAO,mBAAQ,CAAC,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,IAAW;IACzB,OAAO,mBAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,SAAS,CAAC,IAAW;IAClC,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,oBAAU,CAClB,yBAAe,CAAC,SAAS,EACzB,0BAAkB,CACnB,CAAC;IACJ,CAAC;IACD,cAAc;IACd,OAAO,mBAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,OAAO,CAAC,EAAU;IAC/B,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,oBAAU,CAClB,yBAAe,CAAC,SAAS,EACzB,0BAAkB,CACnB,CAAC;IACJ,CAAC;IACD,cAAc;IACd,OAAO,mBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,MAAM;IACN,MAAM;IACN,SAAS;IACT,MAAM,EAAE,OAAO;CACP,CAAC"}
\ No newline at end of file
diff --git a/lib/util/PwdUtil.js b/lib/util/PwdUtil.js
deleted file mode 100644
index 3fff3be..0000000
--- a/lib/util/PwdUtil.js
+++ /dev/null
@@ -1,34 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const bcrypt_1 = __importDefault(require("bcrypt"));
-// **** Variables **** //
-const SALT_ROUNDS = 12;
-// **** Functions **** //
-/**
- * Get a hash from the password.
- */
-function getHash(pwd) {
- return bcrypt_1.default.hash(pwd, SALT_ROUNDS);
-}
-/**
- * Useful for testing.
- */
-function hashSync(pwd) {
- return bcrypt_1.default.hashSync(pwd, SALT_ROUNDS);
-}
-/**
- * See if a password passes the hash.
- */
-function compare(pwd, hash) {
- return bcrypt_1.default.compare(pwd, hash);
-}
-// **** Export Default **** //
-exports.default = {
- getHash,
- hashSync,
- compare,
-};
-//# sourceMappingURL=PwdUtil.js.map
\ No newline at end of file
diff --git a/lib/util/PwdUtil.js.map b/lib/util/PwdUtil.js.map
deleted file mode 100644
index 6cb93f8..0000000
--- a/lib/util/PwdUtil.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"PwdUtil.js","sourceRoot":"","sources":["../../src/util/PwdUtil.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAG5B,yBAAyB;AAEzB,MAAM,WAAW,GAAG,EAAE,CAAC;AAGvB,yBAAyB;AAEzB;;GAEG;AACH,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,gBAAM,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,gBAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,GAAW,EAAE,IAAY;IACxC,OAAO,gBAAM,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,OAAO;IACP,QAAQ;IACR,OAAO;CACC,CAAC"}
\ No newline at end of file
diff --git a/lib/util/SessionUtil.js b/lib/util/SessionUtil.js
deleted file mode 100644
index 56ec8c0..0000000
--- a/lib/util/SessionUtil.js
+++ /dev/null
@@ -1,74 +0,0 @@
-"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const HttpStatusCodes_1 = __importDefault(require("@src/constants/HttpStatusCodes"));
-const classes_1 = require("@src/other/classes");
-const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
-const EnvVars_1 = __importDefault(require("../constants/EnvVars"));
-// **** Variables **** //
-// Errors
-const Errors = {
- ParamFalsey: 'Param is falsey',
- Validation: 'JSON-web-token validation failed.',
-};
-// Options
-const Options = {
- expiresIn: EnvVars_1.default.Jwt.Exp,
-};
-// **** Functions **** //
-/**
- * Get session data from request object (i.e. ISessionUser)
- */
-function getSessionData(req) {
- const { Key } = EnvVars_1.default.CookieProps, jwt = req.signedCookies[Key];
- return _decode(jwt);
-}
-/**
- * Add a JWT to the response
- */
-async function addSessionData(res, data) {
- if (!res || !data) {
- throw new classes_1.RouteError(HttpStatusCodes_1.default.BAD_REQUEST, Errors.ParamFalsey);
- }
- // Setup JWT
- const jwt = await _sign(data), { Key, Options } = EnvVars_1.default.CookieProps;
- // Return
- return res.cookie(Key, jwt, Options);
-}
-/**
- * Remove cookie
- */
-function clearCookie(res) {
- const { Key, Options } = EnvVars_1.default.CookieProps;
- return res.clearCookie(Key, Options);
-}
-// **** Helper Functions **** //
-/**
- * Encrypt data and return jwt.
- */
-function _sign(data) {
- return new Promise((res, rej) => {
- jsonwebtoken_1.default.sign(data, EnvVars_1.default.Jwt.Secret, { expiresIn: '1h' }, (err, token) => {
- return err ? rej(err) : res(token || '');
- });
- });
-}
-/**
- * Decrypt JWT and extract client data.
- */
-function _decode(jwt) {
- return new Promise((res, rej) => {
- jsonwebtoken_1.default.verify(jwt, EnvVars_1.default.Jwt.Secret, undefined, (err, decoded) => {
- return err ? rej(Errors.Validation) : res(decoded);
- });
- });
-}
-// **** Export default **** //
-exports.default = {
- addSessionData,
- getSessionData,
- clearCookie,
-};
-//# sourceMappingURL=SessionUtil.js.map
\ No newline at end of file
diff --git a/lib/util/SessionUtil.js.map b/lib/util/SessionUtil.js.map
deleted file mode 100644
index d8551e0..0000000
--- a/lib/util/SessionUtil.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"SessionUtil.js","sourceRoot":"","sources":["../../src/util/SessionUtil.ts"],"names":[],"mappings":";;;;;AAEA,qFAA6D;AAC7D,gDAAgD;AAChD,gEAAwC;AAExC,mEAA2C;AAG3C,yBAAyB;AAEzB,SAAS;AACT,MAAM,MAAM,GAAG;IACb,WAAW,EAAE,iBAAiB;IAC9B,UAAU,EAAE,mCAAmC;CACvC,CAAC;AAEX,UAAU;AACV,MAAM,OAAO,GAAG;IACd,SAAS,EAAE,iBAAO,CAAC,GAAG,CAAC,GAAG;CAC3B,CAAC;AAGF,yBAAyB;AAEzB;;GAEG;AACH,SAAS,cAAc,CAAI,GAAY;IACrC,MAAM,EAAE,GAAG,EAAE,GAAG,iBAAO,CAAC,WAAW,EACjC,GAAG,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,CAAI,GAAW;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC9B,sBAAY,CAAC,MAAM,CACjB,GAAG,EACH,iBAAO,CAAC,GAAG,CAAC,MAAM,EAClB,SAAS,EACT,CAAC,GAAiB,EAAE,OAA0C,EAAE,EAAE;YAChE,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAY,CAAC,CAAC;QAC1D,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAGD,8BAA8B;AAE9B,kBAAe;IACb,cAAc;IACd,cAAc;IACd,WAAW;CACH,CAAC"}
\ No newline at end of file
diff --git a/lib/util/misc.js b/lib/util/misc.js
deleted file mode 100644
index a5b0f49..0000000
--- a/lib/util/misc.js
+++ /dev/null
@@ -1,24 +0,0 @@
-"use strict";
-/**
- * Miscellaneous shared functions go here.
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.getRandomInt = getRandomInt;
-exports.tick = tick;
-/**
- * Get a random number between 1 and 1,000,000,000,000
- */
-function getRandomInt() {
- return Math.floor(Math.random() * 1000000000000);
-}
-/**
- * Wait for a certain number of milliseconds.
- */
-function tick(milliseconds) {
- return new Promise((resolve) => {
- setTimeout(() => {
- resolve();
- }, milliseconds);
- });
-}
-//# sourceMappingURL=misc.js.map
\ No newline at end of file
diff --git a/lib/util/misc.js.map b/lib/util/misc.js.map
deleted file mode 100644
index 72c52e0..0000000
--- a/lib/util/misc.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/util/misc.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAMH,oCAEC;AAKD,oBAMC;AAhBD;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,aAAiB,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,SAAgB,IAAI,CAAC,YAAoB;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,YAAY,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 5b44246..4bead11 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"@prisma/client": "^6.16.2",
"bcrypt": "^6.0.0",
"cookie-parser": "^1.4.6",
+ "cors": "^2.8.5",
"dotenv": "^16.6.1",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",
@@ -28,6 +29,7 @@
"devDependencies": {
"@types/bcrypt": "^6.0.0",
"@types/cookie-parser": "^1.4.3",
+ "@types/cors": "^2.8.19",
"@types/express": "^4.17.17",
"@types/find": "^0.2.1",
"@types/fs-extra": "^11.0.1",
@@ -477,6 +479,16 @@
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
"dev": true
},
+ "node_modules/@types/cors": {
+ "version": "2.8.19",
+ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz",
+ "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/express": {
"version": "4.17.17",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
@@ -1528,6 +1540,19 @@
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==",
"dev": true
},
+ "node_modules/cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
@@ -3300,6 +3325,15 @@
"node": "^14.16.0 || >=16.10.0"
}
},
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
@@ -4917,6 +4951,15 @@
"integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==",
"dev": true
},
+ "@types/cors": {
+ "version": "2.8.19",
+ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz",
+ "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/express": {
"version": "4.17.17",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
@@ -5702,6 +5745,15 @@
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==",
"dev": true
},
+ "cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "requires": {
+ "object-assign": "^4",
+ "vary": "^1"
+ }
+ },
"create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
@@ -7028,6 +7080,11 @@
"tinyexec": "^1.0.1"
}
},
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
+ },
"object-inspect": {
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
diff --git a/package.json b/package.json
index 78bd2c8..34a931f 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"@prisma/client": "^6.16.2",
"bcrypt": "^6.0.0",
"cookie-parser": "^1.4.6",
+ "cors": "^2.8.5",
"dotenv": "^16.6.1",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",
@@ -47,6 +48,7 @@
"devDependencies": {
"@types/bcrypt": "^6.0.0",
"@types/cookie-parser": "^1.4.3",
+ "@types/cors": "^2.8.19",
"@types/express": "^4.17.17",
"@types/find": "^0.2.1",
"@types/fs-extra": "^11.0.1",
diff --git a/prisma/migrations/20250927131120_init/migration.sql b/prisma/migrations/20250927131120_init/migration.sql
new file mode 100644
index 0000000..18da166
--- /dev/null
+++ b/prisma/migrations/20250927131120_init/migration.sql
@@ -0,0 +1,68 @@
+-- CreateEnum
+CREATE TYPE "public"."UserRole" AS ENUM ('Standard', 'Admin');
+
+-- CreateEnum
+CREATE TYPE "public"."Status" AS ENUM ('todo', 'in_progress', 'done');
+
+-- CreateTable
+CREATE TABLE "public"."User" (
+ "id" SERIAL NOT NULL,
+ "name" TEXT NOT NULL,
+ "email" TEXT NOT NULL,
+ "pwdHash" TEXT,
+ "role" "public"."UserRole" NOT NULL DEFAULT 'Standard',
+
+ CONSTRAINT "User_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "public"."Board" (
+ "id" SERIAL NOT NULL,
+ "userId" INTEGER NOT NULL,
+ "name" TEXT NOT NULL,
+ "description" TEXT,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL,
+
+ CONSTRAINT "Board_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "public"."TaskList" (
+ "id" SERIAL NOT NULL,
+ "boardId" INTEGER NOT NULL,
+ "name" TEXT NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL,
+
+ CONSTRAINT "TaskList_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "public"."Task" (
+ "id" SERIAL NOT NULL,
+ "boardId" INTEGER NOT NULL,
+ "taskListId" INTEGER,
+ "title" TEXT NOT NULL,
+ "description" TEXT,
+ "status" "public"."Status" NOT NULL DEFAULT 'todo',
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL,
+
+ CONSTRAINT "Task_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "User_email_key" ON "public"."User"("email");
+
+-- AddForeignKey
+ALTER TABLE "public"."Board" ADD CONSTRAINT "Board_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "public"."TaskList" ADD CONSTRAINT "TaskList_boardId_fkey" FOREIGN KEY ("boardId") REFERENCES "public"."Board"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "public"."Task" ADD CONSTRAINT "Task_boardId_fkey" FOREIGN KEY ("boardId") REFERENCES "public"."Board"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "public"."Task" ADD CONSTRAINT "Task_taskListId_fkey" FOREIGN KEY ("taskListId") REFERENCES "public"."TaskList"("id") ON DELETE SET NULL ON UPDATE CASCADE;
diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml
new file mode 100644
index 0000000..044d57c
--- /dev/null
+++ b/prisma/migrations/migration_lock.toml
@@ -0,0 +1,3 @@
+# Please do not edit this file manually
+# It should be added in your version-control system (e.g., Git)
+provider = "postgresql"
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index e8b9fe9..e46db00 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -13,3 +13,58 @@ datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
+
+model User {
+ id Int @id @default(autoincrement())
+ name String
+ email String @unique
+ pwdHash String?
+ role UserRole @default(Standard)
+ boards Board[]
+}
+
+model Board {
+ id Int @id @default(autoincrement())
+ userId Int
+ name String
+ description String?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ user User @relation(fields: [userId], references: [id])
+ tasks Task[]
+ taskLists TaskList[]
+}
+
+model TaskList {
+ id Int @id @default(autoincrement())
+ boardId Int
+ name String
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ board Board @relation(fields: [boardId], references: [id])
+ tasks Task[]
+}
+
+model Task {
+ id Int @id @default(autoincrement())
+ boardId Int
+ taskListId Int?
+ title String
+ description String?
+ status Status @default(todo)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ board Board @relation(fields: [boardId], references: [id])
+ taskList TaskList? @relation(fields: [taskListId], references: [id])
+}
+
+enum UserRole {
+ Standard
+ Admin
+}
+
+enum Status {
+ todo
+ in_progress
+ done
+}
diff --git a/src/controllers/board.controller.ts b/src/controllers/board.controller.ts
index 1edb1d3..2183431 100644
--- a/src/controllers/board.controller.ts
+++ b/src/controllers/board.controller.ts
@@ -5,6 +5,7 @@ import { IBoard } from '@src/models/board.model';
class BoardController {
// Get all boards for a user
public getBoardsByUserId = async (req: Request, res: Response) => {
+ console.log('board.controller.ts getBoardsByUserId called with userId:', req.params.userId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -13,6 +14,7 @@ class BoardController {
const boards = await BoardRepo.getBoardsByUserId(userId);
return res.json({ boards });
} catch (err) {
+ console.error('board.controller.ts getBoardsByUserId error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -20,6 +22,7 @@ class BoardController {
// Get single board by userId and boardId
public getBoardByUserId = async (req: Request, res: Response) => {
+ console.log('board.controller.ts getBoardByUserId called with userId:', req.params.userId, 'boardId:', req.params.boardId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -29,6 +32,7 @@ class BoardController {
const board = await BoardRepo.getBoardByUserId(userId, boardId);
return res.json({ board });
} catch (err) {
+ console.error('board.controller.ts getBoardByUserId error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -36,6 +40,7 @@ class BoardController {
// Create board for a user
public createBoard = async (req: Request, res: Response) => {
+ console.log('board.controller.ts createBoard called with userId:', req.params.userId, 'body:', req.body);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -48,6 +53,7 @@ class BoardController {
const board = await BoardRepo.createBoard(userId, boardData);
return res.status(201).json({ board });
} catch (err) {
+ console.error('board.controller.ts createBoard error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -55,6 +61,7 @@ class BoardController {
// Update board for a user
public updateBoard = async (req: Request, res: Response) => {
+ console.log('board.controller.ts updateBoard called with userId:', req.params.userId, 'boardId:', req.params.boardId, 'body:', req.body);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -68,6 +75,7 @@ class BoardController {
const board = await BoardRepo.updateBoard(userId, boardId, boardData);
return res.json({ board });
} catch (err) {
+ console.error('board.controller.ts updateBoard error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -75,6 +83,7 @@ class BoardController {
// Delete board for a user
public deleteBoard = async (req: Request, res: Response) => {
+ console.log('board.controller.ts deleteBoard called with userId:', req.params.userId, 'boardId:', req.params.boardId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -84,6 +93,7 @@ class BoardController {
await BoardRepo.deleteBoard(userId, boardId);
return res.status(204).end();
} catch (err) {
+ console.error('board.controller.ts deleteBoard error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
diff --git a/src/controllers/task.controller.ts b/src/controllers/task.controller.ts
index 41d25c0..754aabe 100644
--- a/src/controllers/task.controller.ts
+++ b/src/controllers/task.controller.ts
@@ -5,6 +5,7 @@ import { ITask } from '@src/models/task.model';
class TaskController {
// Get all tasks for a board
public getTasksByBoardId = async (req: Request, res: Response) => {
+ console.log('task.controller.ts getTasksByBoardId called with boardId:', req.params.boardId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -13,6 +14,7 @@ class TaskController {
const tasks = await TaskRepo.getTasksByBoardId(boardId);
return res.json({ tasks });
} catch (err) {
+ console.error('task.controller.ts getTasksByBoardId error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -20,6 +22,7 @@ class TaskController {
// Get single task by boardId and taskId
public getTaskByBoardId = async (req: Request, res: Response) => {
+ console.log('task.controller.ts getTaskByBoardId called with boardId:', req.params.boardId, 'taskId:', req.params.taskId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -29,6 +32,7 @@ class TaskController {
const task = await TaskRepo.getTaskByBoardId(boardId, taskId);
return res.json({ task });
} catch (err) {
+ console.error('task.controller.ts getTaskByBoardId error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -36,6 +40,7 @@ class TaskController {
// Create task for a board
public createTask = async (req: Request, res: Response) => {
+ console.log('task.controller.ts createTask called with boardId:', req.params.boardId, 'body:', req.body);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -49,6 +54,7 @@ class TaskController {
const task = await TaskRepo.createTask(boardId, taskData);
return res.status(201).json({ task });
} catch (err) {
+ console.error('task.controller.ts createTask error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -56,6 +62,7 @@ class TaskController {
// Update task for a board
public updateTask = async (req: Request, res: Response) => {
+ console.log('task.controller.ts updateTask called with boardId:', req.params.boardId, 'taskId:', req.params.taskId, 'body:', req.body);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -70,6 +77,7 @@ class TaskController {
const task = await TaskRepo.updateTask(boardId, taskId, taskData);
return res.json({ task });
} catch (err) {
+ console.error('task.controller.ts updateTask error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
@@ -77,6 +85,7 @@ class TaskController {
// Delete task for a board
public deleteTask = async (req: Request, res: Response) => {
+ console.log('task.controller.ts deleteTask called with boardId:', req.params.boardId, 'taskId:', req.params.taskId);
try {
if (req.headers.authorization !== 'Bearer testtoken') {
return res.status(401).json({ error: 'Unauthorized' });
@@ -86,6 +95,7 @@ class TaskController {
await TaskRepo.deleteTask(boardId, taskId);
return res.status(204).end();
} catch (err) {
+ console.error('task.controller.ts deleteTask error:', err);
return res.status(500).json({ error: 'Internal server error',
details: String(err) });
}
diff --git a/src/controllers/taskList.controller.ts b/src/controllers/taskList.controller.ts
new file mode 100644
index 0000000..0251cce
--- /dev/null
+++ b/src/controllers/taskList.controller.ts
@@ -0,0 +1,90 @@
+import { Request, Response } from 'express';
+import TaskListRepo from '@src/repos/taskList.repo';
+import { ITaskList } from '@src/models/taskList.model';
+// Extend ITaskList to include boardId for controller usage
+type TaskListInput = ITaskList & { boardId: number };
+
+class TaskListController {
+ public getAll = async (_: Request, res: Response) => {
+ console.log('taskList.controller.ts getAll called');
+ try {
+ const lists = await TaskListRepo.getAll();
+ return res.json({ lists });
+ } catch (err) {
+ console.error('taskList.controller.ts getAll error:', err);
+ return res.status(500).json({
+ error: 'Internal server error',
+ details: String(err),
+ });
+ }
+ };
+
+ public getById = async (req: Request, res: Response) => {
+ console.log('taskList.controller.ts getById called with id:', req.params.id);
+ try {
+ const id = +req.params.id;
+ const list = await TaskListRepo.getById(id);
+ return res.json({ list });
+ } catch (err) {
+ console.error('taskList.controller.ts getById error:', err);
+ return res.status(500).json({
+ error: 'Internal server error',
+ details: String(err),
+ });
+ }
+ };
+
+ public create = async (req: Request, res: Response) => {
+ console.log('taskList.controller.ts create called with boardId:', req.body.boardId, 'body:', req.body);
+ try {
+ const data = req.body as TaskListInput;
+ if (!data.name) {
+ return res.status(400).json({ error: 'Name required' });
+ }
+ if (!data.boardId) {
+ return res.status(400).json({ error: 'boardId required' });
+ }
+ const list = await TaskListRepo.create(Number(data.boardId), data);
+ return res.status(201).json({ list });
+ } catch (err) {
+ console.error('taskList.controller.ts create error:', err);
+ return res.status(500).json({
+ error: 'Internal server error',
+ details: String(err),
+ });
+ }
+ };
+
+ public update = async (req: Request, res: Response) => {
+ console.log('taskList.controller.ts update called with id:', req.params.id, 'body:', req.body);
+ try {
+ const id = +req.params.id;
+ const data = req.body as Partial;
+ const list = await TaskListRepo.update(id, data);
+ return res.json({ list });
+ } catch (err) {
+ console.error('taskList.controller.ts update error:', err);
+ return res.status(500).json({
+ error: 'Internal server error',
+ details: String(err),
+ });
+ }
+ };
+
+ public remove = async (req: Request, res: Response) => {
+ console.log('taskList.controller.ts remove called with id:', req.params.id);
+ try {
+ const id = +req.params.id;
+ const ok = await TaskListRepo.remove(id);
+ return res.json({ ok });
+ } catch (err) {
+ console.error('taskList.controller.ts remove error:', err);
+ return res.status(500).json({
+ error: 'Internal server error',
+ details: String(err),
+ });
+ }
+ };
+}
+
+export default new TaskListController();
diff --git a/src/controllers/user.controller.ts b/src/controllers/user.controller.ts
index a595267..f1969cd 100644
--- a/src/controllers/user.controller.ts
+++ b/src/controllers/user.controller.ts
@@ -4,38 +4,62 @@ import { IUser } from '@src/models/user.model';
class UserController {
public getAll = async (req: Request, res: Response) => {
- if (req.headers.authorization !== 'Bearer testtoken') {
- return res.status(401).json({ error: 'Unauthorized' });
+ console.log('user.controller.ts getAll called');
+ try {
+ if (req.headers.authorization !== 'Bearer testtoken') {
+ return res.status(401).json({ error: 'Unauthorized' });
+ }
+ const users = await UserRepo.getAll();
+ return res.status(200).json({ users });
+ } catch (err) {
+ console.error('user.controller.ts getAll error:', err);
+ return res.status(500).json({ error: 'Internal server error', details: String(err) });
}
- const users = await UserRepo.getAll();
- return res.status(200).json({ users });
};
public add = async (req: Request, res: Response) => {
- if (req.headers.authorization !== 'Bearer testtoken') {
- return res.status(401).json({ error: 'Unauthorized' });
+ console.log('user.controller.ts add called with body:', req.body);
+ try {
+ if (req.headers.authorization !== 'Bearer testtoken') {
+ return res.status(401).json({ error: 'Unauthorized' });
+ }
+ const user = req.body.user as IUser;
+ await UserRepo.add(user);
+ return res.status(201).end();
+ } catch (err) {
+ console.error('user.controller.ts add error:', err);
+ return res.status(500).json({ error: 'Internal server error', details: String(err) });
}
- const user = req.body.user as IUser;
- await UserRepo.add(user);
- return res.status(201).end();
};
public update = async (req: Request, res: Response) => {
- if (req.headers.authorization !== 'Bearer testtoken') {
- return res.status(401).json({ error: 'Unauthorized' });
+ console.log('user.controller.ts update called with body:', req.body);
+ try {
+ if (req.headers.authorization !== 'Bearer testtoken') {
+ return res.status(401).json({ error: 'Unauthorized' });
+ }
+ const user = req.body.user as IUser;
+ await UserRepo.update(user);
+ return res.status(200).end();
+ } catch (err) {
+ console.error('user.controller.ts update error:', err);
+ return res.status(500).json({ error: 'Internal server error', details: String(err) });
}
- const user = req.body.user as IUser;
- await UserRepo.update(user);
- return res.status(200).end();
};
public delete = async (req: Request, res: Response) => {
- if (req.headers.authorization !== 'Bearer testtoken') {
- return res.status(401).json({ error: 'Unauthorized' });
+ console.log('user.controller.ts delete called with id:', req.params.id);
+ try {
+ if (req.headers.authorization !== 'Bearer testtoken') {
+ return res.status(401).json({ error: 'Unauthorized' });
+ }
+ const id = +req.params.id;
+ await UserRepo.delete(id);
+ return res.status(200).end();
+ } catch (err) {
+ console.error('user.controller.ts delete error:', err);
+ return res.status(500).json({ error: 'Internal server error', details: String(err) });
}
- const id = +req.params.id;
- await UserRepo.delete(id);
- return res.status(200).end();
};
}
diff --git a/src/models/board.model.ts b/src/models/board.model.ts
index 23b0c27..89e1d0c 100644
--- a/src/models/board.model.ts
+++ b/src/models/board.model.ts
@@ -19,56 +19,56 @@ export interface IBoard {
* Create new Board.
*/
function new_(
- userId?: number,
- name?: string,
- description?: string,
- createdAt?: string,
- updatedAt?: string,
- id?: number,
+ userId?: number,
+ name?: string,
+ description?: string,
+ createdAt?: string,
+ updatedAt?: string,
+ id?: number,
): IBoard {
- const now = new Date().toISOString();
- return {
- id: (id ?? -1),
- userId: (userId ?? -1),
- name: (name ?? ''),
- description,
- createdAt: (createdAt ?? now),
- updatedAt: (updatedAt ?? now),
- };
+ const now = new Date().toISOString();
+ return {
+ id: (id ?? -1),
+ userId: (userId ?? -1),
+ name: (name ?? ''),
+ description,
+ createdAt: (createdAt ?? now),
+ updatedAt: (updatedAt ?? now),
+ };
}
/**
* Get board instance from object.
*/
function from(param: object): IBoard {
- if (!isBoard(param)) {
- throw new Error(INVALID_CONSTRUCTOR_PARAM);
- }
- const p = param as IBoard;
- return new_(p.userId, p.name, p.description, p.createdAt, p.updatedAt, p.id);
+ if (!isBoard(param)) {
+ throw new Error(INVALID_CONSTRUCTOR_PARAM);
+ }
+ const p = param as IBoard;
+ return new_(p.userId, p.name, p.description, p.createdAt, p.updatedAt, p.id);
}
/**
* See if the param meets criteria to be a board.
*/
function isBoard(arg: unknown): boolean {
- return (
- !!arg &&
+ return (
+ !!arg &&
typeof arg === 'object' &&
'id' in arg &&
'userId' in arg &&
'name' in arg &&
'createdAt' in arg &&
'updatedAt' in arg
- );
+ );
}
// **** Export default **** //
export default {
- new: new_,
- from,
- isBoard,
+ new: new_,
+ from,
+ isBoard,
} as const;
export interface IBoard {
id: number;
diff --git a/src/models/task.model.ts b/src/models/task.model.ts
index ae74fee..e904ad8 100644
--- a/src/models/task.model.ts
+++ b/src/models/task.model.ts
@@ -1,6 +1,7 @@
// **** Variables **** //
-const INVALID_CONSTRUCTOR_PARAM = 'titleOrObj arg must be a string or an object with the appropriate task keys.';
+const INVALID_CONSTRUCTOR_PARAM = 'titleOrObj arg must be a string or an \
+ object with the appropriate task keys.';
// **** Types **** //
@@ -20,43 +21,43 @@ export interface ITask {
* Create new Task.
*/
function new_(
- boardId?: number,
- title?: string,
- status?: 'todo' | 'in-progress' | 'done',
- description?: string,
- createdAt?: string,
- updatedAt?: string,
- id?: number,
+ boardId?: number,
+ title?: string,
+ status?: 'todo' | 'in-progress' | 'done',
+ description?: string,
+ createdAt?: string,
+ updatedAt?: string,
+ id?: number,
): ITask {
- const now = new Date().toISOString();
- return {
- id: (id ?? -1),
- boardId: (boardId ?? -1),
- title: (title ?? ''),
- status: (status ?? 'todo'),
- description,
- createdAt: (createdAt ?? now),
- updatedAt: (updatedAt ?? now),
- };
+ const now = new Date().toISOString();
+ return {
+ id: (id ?? -1),
+ boardId: (boardId ?? -1),
+ title: (title ?? ''),
+ status: (status ?? 'todo'),
+ description,
+ createdAt: (createdAt ?? now),
+ updatedAt: (updatedAt ?? now),
+ };
}
/**
* Get task instance from object.
*/
function from(param: object): ITask {
- if (!isTask(param)) {
- throw new Error(INVALID_CONSTRUCTOR_PARAM);
- }
- const p = param as ITask;
- return new_(p.boardId, p.title, p.status, p.description, p.createdAt, p.updatedAt, p.id);
+ if (!isTask(param)) {
+ throw new Error(INVALID_CONSTRUCTOR_PARAM);
+ }
+ const p = param as ITask;
+ 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: unknown): boolean {
- return (
- !!arg &&
+ return (
+ !!arg &&
typeof arg === 'object' &&
'id' in arg &&
'boardId' in arg &&
@@ -64,15 +65,15 @@ function isTask(arg: unknown): boolean {
'status' in arg &&
'createdAt' in arg &&
'updatedAt' in arg
- );
+ );
}
// **** Export default **** //
export default {
- new: new_,
- from,
- isTask,
+ new: new_,
+ from,
+ isTask,
} as const;
export interface ITask {
id: number;
diff --git a/src/models/taskList.model.ts b/src/models/taskList.model.ts
new file mode 100644
index 0000000..d9a0ca7
--- /dev/null
+++ b/src/models/taskList.model.ts
@@ -0,0 +1,6 @@
+export interface ITaskList {
+ id: number;
+ name: string;
+ createdAt?: string;
+ updatedAt?: string;
+}
diff --git a/src/repos/MockOrm.ts b/src/repos/MockOrm.ts
index 0197884..0071c35 100644
--- a/src/repos/MockOrm.ts
+++ b/src/repos/MockOrm.ts
@@ -5,6 +5,7 @@ import jsonfile from 'jsonfile';
import { IUser } from '@src/models/user.model';
import { IBoard } from '@src/models/board.model';
import { ITask } from '@src/models/task.model';
+import { ITaskList } from '@src/models/taskList.model';
// **** Variables **** //
@@ -18,6 +19,7 @@ interface IDb {
users: IUser[];
boards: IBoard[];
tasks: ITask[];
+ taskLists: ITaskList[];
}
diff --git a/src/repos/TaskRepo.ts b/src/repos/TaskRepo.ts
deleted file mode 100644
index 8371a6d..0000000
--- a/src/repos/TaskRepo.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { ITask } from '@src/models/task.model';
-import orm from './MockOrm';
-
-async function getTasksByBoardId(boardId: number): Promise {
- const db = await orm.openDb();
- return db.tasks.filter((task: ITask) => task.boardId === boardId);
-}
-
-async function getTaskByBoardId(boardId: number, taskId: number): Promise {
- const db = await orm.openDb();
- return db.tasks.find((task: ITask) => task.boardId === boardId && task.id === taskId) || null;
-}
-
-async function createTask(boardId: number, task: ITask): Promise {
- const db = await orm.openDb();
- task.id = Date.now();
- task.boardId = boardId;
- task.createdAt = new Date().toISOString();
- task.updatedAt = task.createdAt;
- db.tasks.push(task);
- await orm.saveDb(db);
- return task;
-}
-
-async function updateTask(boardId: number, taskId: number, taskData: Partial): Promise {
- const db = await orm.openDb();
- const task = db.tasks.find((t: ITask) => t.boardId === boardId && t.id === taskId);
- if (task) {
- Object.assign(task, taskData, { updatedAt: new Date().toISOString() });
- await orm.saveDb(db);
- return task;
- }
- return null;
-}
-
-async function deleteTask(boardId: number, taskId: number): Promise {
- const db = await orm.openDb();
- const idx = db.tasks.findIndex((t: ITask) => t.boardId === boardId && t.id === taskId);
- if (idx !== -1) {
- db.tasks.splice(idx, 1);
- await orm.saveDb(db);
- return true;
- }
- return false;
-}
-
-export default {
- getTasksByBoardId,
- getTaskByBoardId,
- createTask,
- updateTask,
- deleteTask,
-};
diff --git a/src/repos/board.repo.ts b/src/repos/board.repo.ts
index d4bff20..73a5ba8 100644
--- a/src/repos/board.repo.ts
+++ b/src/repos/board.repo.ts
@@ -1,58 +1,88 @@
import { IBoard } from '@src/models/board.model';
-import orm from './MockOrm';
+import { PrismaClient } from '../../generated/prisma';
+const prisma = new PrismaClient();
async function getBoardsByUserId(userId: number): Promise {
- const db = await orm.openDb();
- const boards = Array.isArray(db.boards) ? db.boards : [];
- return boards.filter((board: IBoard) => board.userId === userId);
+ console.log('board.repo.ts getBoardsByUserId called with userId:', userId);
+ const boards = await prisma.board.findMany({ where: { userId } });
+ const mappedBoards = boards.map(b => ({
+ ...b,
+ description: b.description === null ? undefined : b.description,
+ createdAt: b.createdAt.toISOString(),
+ updatedAt: b.updatedAt.toISOString(),
+ }));
+ console.log('board.repo.ts getBoardsByUserId result:', mappedBoards);
+ return mappedBoards;
}
-async function getBoardByUserId(userId: number, boardId: number):
- Promise {
- const db = await orm.openDb();
- const boards = Array.isArray(db.boards) ? db.boards : [];
- return boards.find(
- (board: IBoard) => board.userId === userId && board.id === boardId,
- ) || null;
+async function getBoardByUserId(
+ userId: number,
+ boardId: number,
+): Promise {
+ console.log('board.repo.ts getBoardByUserId called with userId:', userId, 'boardId:', boardId);
+ const b = await prisma.board.findFirst({ where: { userId, id: boardId } });
+ if (!b) return null;
+ const result = {
+ ...b,
+ description: b.description === null ? undefined : b.description,
+ createdAt: b.createdAt.toISOString(),
+ updatedAt: b.updatedAt.toISOString(),
+ };
+ console.log('board.repo.ts getBoardByUserId result:', result);
+ return result;
}
async function createBoard(userId: number, board: IBoard): Promise {
- const db = await orm.openDb();
- if (!Array.isArray(db.boards)) db.boards = [];
- board.id = Date.now();
- board.userId = userId;
- board.createdAt = new Date().toISOString();
- board.updatedAt = board.createdAt;
- db.boards.push(board);
- await orm.saveDb(db);
- return board;
+ console.log('board.repo.ts createBoard called with userId:', userId, 'board:', board);
+ const b = await prisma.board.create({
+ data: {
+ userId,
+ name: board.name,
+ description: board.description,
+ },
+ });
+ const result = {
+ ...b,
+ description: b.description === null ? undefined : b.description,
+ createdAt: b.createdAt.toISOString(),
+ updatedAt: b.updatedAt.toISOString(),
+ };
+ console.log('board.repo.ts createBoard result:', result);
+ return result;
}
-async function updateBoard(userId: number, boardId: number, boardData:
- Partial): Promise {
- const db = await orm.openDb();
- const boards = Array.isArray(db.boards) ? db.boards : [];
- const board = boards.find((b: IBoard) => b.userId === userId &&
- b.id === boardId);
- if (board) {
- Object.assign(board, boardData, { updatedAt: new Date().toISOString() });
- await orm.saveDb(db);
- return board;
+async function updateBoard(
+ userId: number,
+ boardId: number,
+ boardData: Partial,
+): Promise {
+ console.log('board.repo.ts updateBoard called with userId:', userId, 'boardId:', boardId, 'boardData:', boardData);
+ const updated = await prisma.board.updateMany({
+ where: { id: boardId, userId },
+ data: { ...boardData },
+ });
+ if (updated.count > 0) {
+ const b = await prisma.board.findFirst({ where: { id: boardId, userId } });
+ if (!b) return null;
+ const result = {
+ ...b,
+ description: b.description === null ? undefined : b.description,
+ createdAt: b.createdAt.toISOString(),
+ updatedAt: b.updatedAt.toISOString(),
+ };
+ console.log('board.repo.ts updateBoard result:', result);
+ return result;
}
return null;
}
async function deleteBoard(userId: number, boardId: number): Promise {
- const db = await orm.openDb();
- const boards = Array.isArray(db.boards) ? db.boards : [];
- const idx = boards.findIndex((b: IBoard) => b.userId === userId &&
- b.id === boardId);
- if (idx !== -1) {
- boards.splice(idx, 1);
- await orm.saveDb(db);
- return true;
- }
- return false;
+ console.log('board.repo.ts deleteBoard called with userId:', userId, 'boardId:', boardId);
+ const deleted = await prisma.board.deleteMany({
+ where: { id: boardId, userId },
+ });
+ console.log('board.repo.ts deleteBoard completed for userId:', userId, 'boardId:', boardId);
+ return deleted.count > 0;
}
export default {
diff --git a/src/repos/database.json b/src/repos/database.json
index 2d3d2d1..2e34180 100644
--- a/src/repos/database.json
+++ b/src/repos/database.json
@@ -1 +1 @@
-{"users":[{"name":"Sean Maxwell","email":"sean.maxwell@gmail.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":1,"id":159123164363},{"name":"Gordan Freeman","email":"gordan.freeman@halflife.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":0,"id":906524522143},{"name":"John Smith","email":"jsmith@yahoo.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":0,"id":357437875835},{"id":75800032258,"name":"asdf","email":"asdfasdf","role":0}],"boards":[{"name":"Project Board","id":1758960982352,"userId":1,"createdAt":"2025-09-27T08:16:22.352Z","updatedAt":"2025-09-27T08:16:22.352Z"}],"tasks":[{"title":"New Task","description":"Task details","status":"todo","id":1758961254717,"boardId":1758960982352,"createdAt":"2025-09-27T08:20:54.717Z","updatedAt":"2025-09-27T08:20:54.717Z"},{"title":"New Task 2","description":"Task details 2","status":"todo","id":1758961267429,"boardId":1758960982352,"createdAt":"2025-09-27T08:21:07.429Z","updatedAt":"2025-09-27T08:21:07.429Z"}]}
+{"users":[{"name":"Sean Maxwell","email":"sean.maxwell@gmail.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":1,"id":159123164363},{"name":"Gordan Freeman","email":"gordan.freeman@halflife.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":0,"id":906524522143},{"name":"John Smith","email":"jsmith@yahoo.com","pwdHash":"$2b$12$1mE2OI9hMS/rgH9Mi0s85OM2V5gzm7aF3gJIWH1y0S1MqVBueyjsy","role":0,"id":357437875835},{"id":75800032258,"name":"asdf","email":"asdfasdf","role":0}],"boards":[{"name":"Project Board","id":1758960982352,"userId":1,"createdAt":"2025-09-27T08:16:22.352Z","updatedAt":"2025-09-27T08:16:22.352Z"},{"name":"asfdsadff","id":1758972779232,"userId":1,"createdAt":"2025-09-27T11:32:59.232Z","updatedAt":"2025-09-27T11:32:59.232Z"},{"name":"Marketing Plan","id":1758977959686,"userId":1,"createdAt":"2025-09-27T12:59:19.686Z","updatedAt":"2025-09-27T12:59:19.686Z"}],"tasks":[{"title":"New Task","description":"Task details","status":"todo","id":1758961254717,"boardId":1758960982352,"createdAt":"2025-09-27T08:20:54.717Z","updatedAt":"2025-09-27T08:20:54.717Z"},{"title":"New Task 2","description":"Task details 2","status":"todo","id":1758961267429,"boardId":1758960982352,"createdAt":"2025-09-27T08:21:07.429Z","updatedAt":"2025-09-27T08:21:07.429Z"},{"title":"New Task 3","description":"Dummy details","status":"in-progress","id":1758977469970,"boardId":1758960982352,"createdAt":"2025-09-27T12:51:09.970Z","updatedAt":"2025-09-27T12:51:09.970Z"},{"title":"New Task 4","description":"Dummy still","status":"done","id":1758977546230,"boardId":1758960982352,"createdAt":"2025-09-27T12:52:26.230Z","updatedAt":"2025-09-27T12:52:26.230Z"},{"title":"NT 5","description":"","status":"in-progress","id":1758977665176,"boardId":1758960982352,"createdAt":"2025-09-27T12:54:25.176Z","updatedAt":"2025-09-27T12:54:25.176Z"}]}
diff --git a/src/repos/task.repo.ts b/src/repos/task.repo.ts
index 51ebe0c..67547e2 100644
--- a/src/repos/task.repo.ts
+++ b/src/repos/task.repo.ts
@@ -1,57 +1,90 @@
import { ITask } from '@src/models/task.model';
-import orm from './MockOrm';
+import { PrismaClient } from '../../generated/prisma';
+const prisma = new PrismaClient();
async function getTasksByBoardId(boardId: number): Promise {
- const db = await orm.openDb();
- const tasks = Array.isArray(db.tasks) ? db.tasks : [];
- return tasks.filter((task: ITask) => task.boardId === boardId);
+ const tasks = await prisma.task.findMany({ where: { boardId } });
+ return tasks.map(t => ({
+ ...t,
+ description: t.description === null ? undefined : t.description,
+ status: t.status === 'in_progress' ? 'in-progress' : t.status,
+ createdAt: t.createdAt.toISOString(),
+ updatedAt: t.updatedAt.toISOString(),
+ }));
}
async function getTaskByBoardId(boardId: number, taskId: number):
- Promise {
- const db = await orm.openDb();
- const tasks = Array.isArray(db.tasks) ? db.tasks : [];
- return tasks.find((task: ITask) => task.boardId === boardId &&
- task.id === taskId) || null;
+ Promise {
+ const t = await prisma.task.findFirst({ where: { boardId, id: taskId } });
+ if (!t) return null;
+ return {
+ ...t,
+ description: t.description === null ? undefined : t.description,
+ status: t.status === 'in_progress' ? 'in-progress' : t.status,
+ createdAt: t.createdAt.toISOString(),
+ updatedAt: t.updatedAt.toISOString(),
+ };
}
async function createTask(boardId: number, task: ITask): Promise {
- const db = await orm.openDb();
- if (!Array.isArray(db.tasks)) db.tasks = [];
- task.id = Date.now();
- task.boardId = boardId;
- task.createdAt = new Date().toISOString();
- task.updatedAt = task.createdAt;
- db.tasks.push(task);
- await orm.saveDb(db);
- return task;
+ const prismaStatus = task.status === 'in-progress' ? 'in_progress' :
+ task.status;
+ console.log('task.repo.ts createTask called with task:', task);
+ const t = await prisma.task.create({
+ data: {
+ boardId,
+ title: task.title,
+ description: task.description,
+ status: prismaStatus,
+ },
+ });
+ console.log('task.repo.ts createTask result:', t);
+ return {
+ ...t,
+ description: t.description === null ? undefined : t.description,
+ status: t.status === 'in_progress' ? 'in-progress' : t.status,
+ createdAt: t.createdAt.toISOString(),
+ updatedAt: t.updatedAt.toISOString(),
+ };
}
-async function updateTask(boardId: number, taskId: number, taskData:
- Partial): Promise {
- const db = await orm.openDb();
- const tasks = Array.isArray(db.tasks) ? db.tasks : [];
- const task = tasks.find((t: ITask) => t.boardId === boardId &&
- t.id === taskId);
- if (task) {
- Object.assign(task, taskData, { updatedAt: new Date().toISOString() });
- await orm.saveDb(db);
- return task;
+async function updateTask(
+ boardId: number,
+ taskId: number,
+ taskData: Partial,
+): Promise {
+ console.log('task.repo.ts updateTask called with taskId:', taskId, 'and taskData:', taskData);
+ const updateData: Partial = { ...taskData };
+ // Remove id if present
+ delete updateData.id;
+ // Map status to Prisma enum
+ if (updateData.status === 'in-progress') updateData.status = 'in-progress';
+ const updated = await prisma.task.updateMany({
+ where: { id: taskId, boardId },
+ data: updateData as number,
+ });
+ if (updated.count > 0) {
+ const t = await prisma.task.findFirst({ where: { id: taskId, boardId } });
+ if (!t) return null;
+ console.log('task.repo.ts updateTask result:', t);
+ return {
+ ...t,
+ description: t.description === null ? undefined : t.description,
+ status: t.status === 'in_progress' ? 'in-progress' : t.status,
+ createdAt: t.createdAt.toISOString(),
+ updatedAt: t.updatedAt.toISOString(),
+ };
}
return null;
}
async function deleteTask(boardId: number, taskId: number): Promise {
- const db = await orm.openDb();
- const tasks = Array.isArray(db.tasks) ? db.tasks : [];
- const idx = tasks.findIndex((t: ITask) => t.boardId === boardId &&
- t.id === taskId);
- if (idx !== -1) {
- tasks.splice(idx, 1);
- await orm.saveDb(db);
- return true;
- }
- return false;
+ console.log('task.repo.ts deleteTask called with taskId:', taskId);
+ const deleted = await prisma.task.deleteMany({
+ where: { id: taskId, boardId },
+ });
+ console.log('task.repo.ts deleteTask completed for taskId:', taskId);
+ return deleted.count > 0;
}
export default {
diff --git a/src/repos/taskList.repo.ts b/src/repos/taskList.repo.ts
new file mode 100644
index 0000000..b1b751d
--- /dev/null
+++ b/src/repos/taskList.repo.ts
@@ -0,0 +1,77 @@
+import { ITaskList } from '@src/models/taskList.model';
+import { PrismaClient } from '../../generated/prisma';
+const prisma = new PrismaClient();
+
+async function getAll(): Promise {
+ console.log('taskList.repo.ts getAll called');
+ const lists = await prisma.taskList.findMany();
+ const mappedLists = lists.map(l => ({
+ ...l,
+ createdAt: l.createdAt.toISOString(),
+ updatedAt: l.updatedAt.toISOString(),
+ }));
+ console.log('taskList.repo.ts getAll result:', mappedLists);
+ return mappedLists;
+}
+
+async function getById(id: number): Promise {
+ console.log('taskList.repo.ts getById called with id:', id);
+ const l = await prisma.taskList.findUnique({ where: { id } });
+ if (!l) return null;
+ const result = {
+ ...l,
+ createdAt: l.createdAt.toISOString(),
+ updatedAt: l.updatedAt.toISOString(),
+ };
+ console.log('taskList.repo.ts getById result:', result);
+ return result;
+}
+
+async function create(boardId: number, list: ITaskList): Promise {
+ console.log('taskList.repo.ts create called with boardId:', boardId, 'list:', list);
+ const l = await prisma.taskList.create({
+ data: {
+ name: list.name,
+ boardId,
+ },
+ });
+ const result = {
+ ...l,
+ createdAt: l.createdAt.toISOString(),
+ updatedAt: l.updatedAt.toISOString(),
+ };
+ console.log('taskList.repo.ts create result:', result);
+ return result;
+}
+
+async function update(
+ id: number,
+ data: Partial,
+): Promise {
+ console.log('taskList.repo.ts update called with id:', id, 'data:', data);
+ const updated = await prisma.taskList.updateMany({
+ where: { id },
+ data: { ...data },
+ });
+ if (updated.count > 0) {
+ const l = await prisma.taskList.findUnique({ where: { id } });
+ if (!l) return null;
+ const result = {
+ ...l,
+ createdAt: l.createdAt.toISOString(),
+ updatedAt: l.updatedAt.toISOString(),
+ };
+ console.log('taskList.repo.ts update result:', result);
+ return result;
+ }
+ return null;
+}
+
+async function remove(id: number): Promise {
+ console.log('taskList.repo.ts remove called with id:', id);
+ const deleted = await prisma.taskList.deleteMany({ where: { id } });
+ console.log('taskList.repo.ts remove completed for id:', id);
+ return deleted.count > 0;
+}
+
+export default { getAll, getById, create, update, remove };
diff --git a/src/repos/user.repo.ts b/src/repos/user.repo.ts
index a8760a0..23ad2bb 100644
--- a/src/repos/user.repo.ts
+++ b/src/repos/user.repo.ts
@@ -1,6 +1,6 @@
import { IUser } from '@src/models/user.model';
-import { getRandomInt } from '@src/util/misc';
-import orm from './MockOrm';
+import { PrismaClient } from '../../generated/prisma';
+const prisma = new PrismaClient();
// **** Functions **** //
@@ -9,70 +9,71 @@ import orm from './MockOrm';
* Get one user.
*/
async function getOne(email: string): Promise {
- const db = await orm.openDb();
- for (const user of db.users) {
- if (user.email === email) {
- return user;
- }
- }
- return null;
+ const user = await prisma.user.findUnique({ where: { email } });
+ if (!user) return null;
+ return {
+ ...user,
+ pwdHash: user.pwdHash === null ? undefined : user.pwdHash,
+ role: user.role === 'Admin' ? 1 : 0,
+ };
}
+// removed stray closing brace
/**
* See if a user with the given id exists.
*/
async function persists(id: number): Promise {
- const db = await orm.openDb();
- for (const user of db.users) {
- if (user.id === id) {
- return true;
- }
- }
- return false;
+ const user = await prisma.user.findUnique({ where: { id } });
+ return !!user;
}
/**
* Get all users.
*/
async function getAll(): Promise {
- const db = await orm.openDb();
- return db.users;
+ const users = await prisma.user.findMany();
+ return users.map(user => ({
+ ...user,
+ pwdHash: user.pwdHash === null ? undefined : user.pwdHash,
+ role: user.role === 'Admin' ? 1 : 0,
+ }));
}
/**
* Add one user.
*/
async function add(user: IUser): Promise {
- const db = await orm.openDb();
- user.id = getRandomInt();
- db.users.push(user);
- return orm.saveDb(db);
+ await prisma.user.create({
+ data: {
+ // removed leftover MockOrm code
+ name: user.name,
+ email: user.email,
+ pwdHash: user.pwdHash,
+ role: (user.role as unknown) === 1 ? 'Admin' : 'Standard',
+ },
+ });
}
/**
* Update a user.
*/
async function update(user: IUser): Promise {
- const db = await orm.openDb();
- for (let i = 0; i < db.users.length; i++) {
- if (db.users[i].id === user.id) {
- db.users[i] = user;
- return orm.saveDb(db);
- }
- }
+ await prisma.user.update({
+ where: { id: user.id },
+ data: {
+ name: user.name,
+ email: user.email,
+ pwdHash: user.pwdHash,
+ role: (user.role as unknown) === 1 ? 'Admin' : 'Standard',
+ },
+ });
}
/**
* Delete one user.
*/
async function delete_(id: number): Promise {
- const db = await orm.openDb();
- for (let i = 0; i < db.users.length; i++) {
- if (db.users[i].id === id) {
- db.users.splice(i, 1);
- return orm.saveDb(db);
- }
- }
+ await prisma.user.delete({ where: { id } });
}
diff --git a/src/routes/board.route.ts b/src/routes/board.route.ts
index bc414d2..387682b 100644
--- a/src/routes/board.route.ts
+++ b/src/routes/board.route.ts
@@ -1,13 +1,12 @@
-
import { Router } from 'express';
import BoardController from '../controllers/board.controller';
const router = Router();
-router.get('/user/:userId', BoardController.getBoardsByUserId);
-router.get('/user/:userId/:boardId', BoardController.getBoardByUserId);
-router.post('/user/:userId', BoardController.createBoard);
-router.put('/user/:userId/:boardId', BoardController.updateBoard);
-router.delete('/user/:userId/:boardId', BoardController.deleteBoard);
+router.get('/:userId', BoardController.getBoardsByUserId);
+router.get('/:userId/:boardId', BoardController.getBoardByUserId);
+router.post('/:userId', BoardController.createBoard);
+router.put('/:userId/:boardId', BoardController.updateBoard);
+router.delete('/:userId/:boardId', BoardController.deleteBoard);
export default router;
diff --git a/src/routes/index.ts b/src/routes/index.ts
index e023f14..cfbb3bc 100644
--- a/src/routes/index.ts
+++ b/src/routes/index.ts
@@ -1,5 +1,6 @@
import { Router } from 'express';
import boardRouter from './board.route';
+import taskListRouter from './taskList.route';
import taskRouter from './task.route';
import userRouter from './user.route';
@@ -8,5 +9,6 @@ const router = Router();
router.use('/boards', boardRouter);
router.use('/tasks', taskRouter);
router.use('/users', userRouter);
+router.use('/task-lists', taskListRouter);
export default router;
diff --git a/src/routes/task.route.ts b/src/routes/task.route.ts
index d37e81c..7a4efe7 100644
--- a/src/routes/task.route.ts
+++ b/src/routes/task.route.ts
@@ -4,10 +4,10 @@ import TaskController from '../controllers/task.controller';
const router = Router();
-router.get('/board/:boardId', TaskController.getTasksByBoardId);
-router.get('/board/:boardId/:taskId', TaskController.getTaskByBoardId);
-router.post('/board/:boardId', TaskController.createTask);
-router.put('/board/:boardId/:taskId', TaskController.updateTask);
-router.delete('/board/:boardId/:taskId', TaskController.deleteTask);
+router.get('/:boardId', TaskController.getTasksByBoardId);
+router.get('/:boardId/:taskId', TaskController.getTaskByBoardId);
+router.post('/:boardId', TaskController.createTask);
+router.put('/:boardId/:taskId', TaskController.updateTask);
+router.delete('/:boardId/:taskId', TaskController.deleteTask);
export default router;
diff --git a/src/routes/taskList.route.ts b/src/routes/taskList.route.ts
new file mode 100644
index 0000000..bd99e7d
--- /dev/null
+++ b/src/routes/taskList.route.ts
@@ -0,0 +1,12 @@
+import { Router } from 'express';
+import TaskListController from '@src/controllers/taskList.controller';
+
+const router = Router();
+
+router.get('/', TaskListController.getAll);
+router.get('/:id', TaskListController.getById);
+router.post('/', TaskListController.create);
+router.put('/:id', TaskListController.update);
+router.delete('/:id', TaskListController.remove);
+
+export default router;
diff --git a/src/server.ts b/src/server.ts
index 14b4018..3dfcf06 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -3,6 +3,7 @@
*/
import cookieParser from 'cookie-parser';
+import cors from 'cors';
import morgan from 'morgan';
import path from 'path';
import helmet from 'helmet';
@@ -28,6 +29,8 @@ const app = express();
// **** Setup **** //
// Basic middleware
+// eslint-disable-next-line @typescript-eslint/no-unsafe-call
+app.use(cors());
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.use(cookieParser(EnvVars.CookieProps.Secret));