express-generator-typescript 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli.js +1 -20
- package/lib/template/README.md +3 -2
- package/lib/template/package.json +5 -5
- package/lib/template/src/common/classes/route-errors.ts +0 -13
- package/lib/template/src/common/constants/Paths/Paths.ts +29 -0
- package/lib/template/src/common/constants/Paths/helpers.ts +29 -0
- package/lib/template/src/common/constants/Paths/index.ts +1 -0
- package/lib/template/src/common/constants/{environment-consts.ts → env.constants.ts} +13 -15
- package/lib/template/src/common/utils/{date-utils.ts → date.utils.ts} +10 -12
- package/lib/template/src/common/utils/validators.ts +0 -23
- package/lib/template/src/entities/User/module.ts +77 -28
- package/lib/template/src/entities/common/entity-base-types.ts +1 -1
- package/lib/template/src/main.ts +3 -3
- package/lib/template/src/public/scripts/lib/bootstrap.bundle.min.js +0 -1
- package/lib/template/src/public/scripts/users.js +19 -10
- package/lib/template/src/public/stylesheets/lib/bootstrap.min.css +0 -1
- package/lib/template/src/public/stylesheets/users.css +24 -1
- package/lib/template/src/repos/MockOrm.ts +2 -2
- package/lib/template/src/repos/UserRepo.ts +5 -15
- package/lib/template/src/repos/common/database.json +3 -3
- package/lib/template/src/{routes/apiRouter.ts → routers/api.router.ts} +3 -11
- package/lib/template/src/{routes/UserRoutes.ts → routers/user.router.ts} +37 -46
- package/lib/template/src/server.ts +20 -7
- package/lib/template/src/views/users.html +8 -0
- package/lib/template/tests/support/utils.ts +23 -0
- package/lib/template/tests/users.test.ts +99 -50
- package/package.json +6 -5
- package/lib/template/src/common/constants/Paths.ts +0 -16
- package/lib/template/src/entities/User/_internal/validators.ts +0 -47
- package/lib/template/src/routes/common/express-types.ts +0 -9
- package/lib/template/src/routes/common/parseReq.ts +0 -23
- package/lib/template/tests/common/comparators.ts +0 -36
- package/lib/template/tests/common/supertest-types.ts +0 -11
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { UserEntity } from '@src/entities/User';
|
|
2
|
-
|
|
3
|
-
// ========================================================================= //
|
|
4
|
-
// TYPES //
|
|
5
|
-
// ========================================================================= //
|
|
6
|
-
|
|
7
|
-
type UserArray = UserEntity[] | readonly UserEntity[];
|
|
8
|
-
|
|
9
|
-
// ========================================================================= //
|
|
10
|
-
// FUNCTIONS //
|
|
11
|
-
// ========================================================================= //
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Compare to user arrays. Order does not matter and this assumes the email
|
|
15
|
-
* field is unique
|
|
16
|
-
*/
|
|
17
|
-
export function compareUserArrays(a: UserArray, b: UserArray): boolean {
|
|
18
|
-
if (a.length !== b.length) return false;
|
|
19
|
-
const aSorted = sortByEmail(a);
|
|
20
|
-
const bSorted = sortByEmail(b);
|
|
21
|
-
for (let i = 0; i < aSorted.length; i++) {
|
|
22
|
-
const a = aSorted[i];
|
|
23
|
-
const b = bSorted[i];
|
|
24
|
-
if (a.email !== b.email || a.name !== b.name) return false;
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Sort user array by email.
|
|
31
|
-
*/
|
|
32
|
-
function sortByEmail(arr: UserArray): UserEntity[] {
|
|
33
|
-
return [...arr].sort((x, y) => {
|
|
34
|
-
return x.email.localeCompare(y.email);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ParseError } from 'jet-validators/utils';
|
|
2
|
-
import type { Response } from 'supertest';
|
|
3
|
-
|
|
4
|
-
// ========================================================================= //
|
|
5
|
-
// TYPES //
|
|
6
|
-
// ========================================================================= //
|
|
7
|
-
|
|
8
|
-
// Use generics to add properties to 'body'
|
|
9
|
-
export interface TestRes<T = object> extends Omit<Response, 'body'> {
|
|
10
|
-
body: T & { error?: string; errors?: ParseError[] };
|
|
11
|
-
}
|