create-craftjs 2.0.2 → 2.0.4
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/package.json +1 -1
- package/template/babel.config.json +24 -1
- package/template/craft/commands/build.js +3 -1
- package/template/craft/commands/dev.js +15 -4
- package/template/package-lock.json +238 -2
- package/template/package.json +20 -2
- package/template/prisma.config.ts +2 -2
- package/template/src/apidocs/auth-docs.ts +6 -72
- package/template/src/apidocs/users-docs.ts +8 -7
- package/template/{prisma → src/database/seeders}/seed.ts +4 -5
- package/template/src/services/user-service.ts +4 -2
- package/template/src/utils/swagger.ts +2 -2
- package/template/src/validations/user-validation.ts +6 -9
- /package/template/{prisma → src/database}/migrations/20250518142257_create_table_users/migration.sql +0 -0
- /package/template/{prisma → src/database}/migrations/20260118135332_create_table_auth_refresh_tokens/migration.sql +0 -0
- /package/template/{prisma → src/database}/migrations/migration_lock.toml +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-craftjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-craftjs": "bin/index.js"
|
|
@@ -1,3 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"presets": [
|
|
2
|
+
"presets": [
|
|
3
|
+
["@babel/preset-env", { "targets": { "node": "current" } }],
|
|
4
|
+
"@babel/preset-typescript"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
[
|
|
8
|
+
"module-resolver",
|
|
9
|
+
{
|
|
10
|
+
"root": ["./"],
|
|
11
|
+
"alias": {
|
|
12
|
+
"@config": "./src/config",
|
|
13
|
+
"@controllers": "./src/controllers",
|
|
14
|
+
"@services": "./src/services",
|
|
15
|
+
"@repositories": "./src/repositories",
|
|
16
|
+
"@routes": "./src/routes",
|
|
17
|
+
"@middleware": "./src/middleware",
|
|
18
|
+
"@dtos": "./src/dtos",
|
|
19
|
+
"@types": "./src/types",
|
|
20
|
+
"@utils": "./src/utils",
|
|
21
|
+
"@validations": "./src/validations"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
]
|
|
3
26
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
const { execSync } = require("child_process");
|
|
2
2
|
const chalk = require("chalk");
|
|
3
|
+
|
|
3
4
|
function Build() {
|
|
4
5
|
console.log(chalk.blue("📦 Building project..."));
|
|
5
6
|
|
|
6
7
|
try {
|
|
7
|
-
execSync("npx tsc && tsc-alias && cp -r src/views build/views", {
|
|
8
|
+
execSync("npx tsc && npx tsc-alias && cp -r src/views build/views", {
|
|
8
9
|
stdio: "inherit",
|
|
9
10
|
});
|
|
10
11
|
execSync("cp -r public build/public", { stdio: "inherit" });
|
|
12
|
+
|
|
11
13
|
console.log(chalk.green("✅ Build completed successfully."));
|
|
12
14
|
} catch (error) {
|
|
13
15
|
console.error(chalk.red("❌ Build failed."));
|
|
@@ -3,10 +3,21 @@ const chalk = require("chalk");
|
|
|
3
3
|
|
|
4
4
|
function Dev() {
|
|
5
5
|
console.log(chalk.blue("🚀 Starting development server with nodemon..."));
|
|
6
|
-
const result = spawnSync(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const result = spawnSync(
|
|
7
|
+
"nodemon",
|
|
8
|
+
[
|
|
9
|
+
"--watch",
|
|
10
|
+
"src",
|
|
11
|
+
"--ext",
|
|
12
|
+
"ts",
|
|
13
|
+
"--exec",
|
|
14
|
+
"ts-node -r tsconfig-paths/register src/main.ts",
|
|
15
|
+
],
|
|
16
|
+
{
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
shell: true,
|
|
19
|
+
}
|
|
20
|
+
);
|
|
10
21
|
|
|
11
22
|
if (result.status !== 0) {
|
|
12
23
|
console.error(chalk.red("❌ Failed to start development server."));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "craftjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "craftjs",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.4",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@prisma/adapter-mariadb": "^7.2.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@types/swagger-jsdoc": "^6.0.4",
|
|
56
56
|
"@types/swagger-ui-express": "^4.1.8",
|
|
57
57
|
"babel-jest": "^29.7.0",
|
|
58
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
58
59
|
"jest": "^29.7.0",
|
|
59
60
|
"nodemon": "^3.1.9",
|
|
60
61
|
"prettier": "^3.5.3",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"ts-jest": "^29.3.4",
|
|
64
65
|
"ts-node": "^10.9.2",
|
|
65
66
|
"tsc-alias": "^1.8.16",
|
|
67
|
+
"tsconfig-paths": "^4.2.0",
|
|
66
68
|
"tsx": "^4.19.4",
|
|
67
69
|
"typescript": "^5.8.3"
|
|
68
70
|
}
|
|
@@ -3830,6 +3832,65 @@
|
|
|
3830
3832
|
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
|
3831
3833
|
}
|
|
3832
3834
|
},
|
|
3835
|
+
"node_modules/babel-plugin-module-resolver": {
|
|
3836
|
+
"version": "5.0.2",
|
|
3837
|
+
"resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-5.0.2.tgz",
|
|
3838
|
+
"integrity": "sha512-9KtaCazHee2xc0ibfqsDeamwDps6FZNo5S0Q81dUqEuFzVwPhcT4J5jOqIVvgCA3Q/wO9hKYxN/Ds3tIsp5ygg==",
|
|
3839
|
+
"dev": true,
|
|
3840
|
+
"license": "MIT",
|
|
3841
|
+
"dependencies": {
|
|
3842
|
+
"find-babel-config": "^2.1.1",
|
|
3843
|
+
"glob": "^9.3.3",
|
|
3844
|
+
"pkg-up": "^3.1.0",
|
|
3845
|
+
"reselect": "^4.1.7",
|
|
3846
|
+
"resolve": "^1.22.8"
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3849
|
+
"node_modules/babel-plugin-module-resolver/node_modules/brace-expansion": {
|
|
3850
|
+
"version": "2.0.2",
|
|
3851
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
|
3852
|
+
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
|
3853
|
+
"dev": true,
|
|
3854
|
+
"license": "MIT",
|
|
3855
|
+
"dependencies": {
|
|
3856
|
+
"balanced-match": "^1.0.0"
|
|
3857
|
+
}
|
|
3858
|
+
},
|
|
3859
|
+
"node_modules/babel-plugin-module-resolver/node_modules/glob": {
|
|
3860
|
+
"version": "9.3.5",
|
|
3861
|
+
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
|
|
3862
|
+
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
|
|
3863
|
+
"dev": true,
|
|
3864
|
+
"license": "ISC",
|
|
3865
|
+
"dependencies": {
|
|
3866
|
+
"fs.realpath": "^1.0.0",
|
|
3867
|
+
"minimatch": "^8.0.2",
|
|
3868
|
+
"minipass": "^4.2.4",
|
|
3869
|
+
"path-scurry": "^1.6.1"
|
|
3870
|
+
},
|
|
3871
|
+
"engines": {
|
|
3872
|
+
"node": ">=16 || 14 >=14.17"
|
|
3873
|
+
},
|
|
3874
|
+
"funding": {
|
|
3875
|
+
"url": "https://github.com/sponsors/isaacs"
|
|
3876
|
+
}
|
|
3877
|
+
},
|
|
3878
|
+
"node_modules/babel-plugin-module-resolver/node_modules/minimatch": {
|
|
3879
|
+
"version": "8.0.4",
|
|
3880
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
|
|
3881
|
+
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
|
|
3882
|
+
"dev": true,
|
|
3883
|
+
"license": "ISC",
|
|
3884
|
+
"dependencies": {
|
|
3885
|
+
"brace-expansion": "^2.0.1"
|
|
3886
|
+
},
|
|
3887
|
+
"engines": {
|
|
3888
|
+
"node": ">=16 || 14 >=14.17"
|
|
3889
|
+
},
|
|
3890
|
+
"funding": {
|
|
3891
|
+
"url": "https://github.com/sponsors/isaacs"
|
|
3892
|
+
}
|
|
3893
|
+
},
|
|
3833
3894
|
"node_modules/babel-plugin-polyfill-corejs2": {
|
|
3834
3895
|
"version": "0.4.13",
|
|
3835
3896
|
"resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.13.tgz",
|
|
@@ -5499,6 +5560,16 @@
|
|
|
5499
5560
|
"node": ">= 0.8"
|
|
5500
5561
|
}
|
|
5501
5562
|
},
|
|
5563
|
+
"node_modules/find-babel-config": {
|
|
5564
|
+
"version": "2.1.2",
|
|
5565
|
+
"resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-2.1.2.tgz",
|
|
5566
|
+
"integrity": "sha512-ZfZp1rQyp4gyuxqt1ZqjFGVeVBvmpURMqdIWXbPRfB97Bf6BzdK/xSIbylEINzQ0kB5tlDQfn9HkNXXWsqTqLg==",
|
|
5567
|
+
"dev": true,
|
|
5568
|
+
"license": "MIT",
|
|
5569
|
+
"dependencies": {
|
|
5570
|
+
"json5": "^2.2.3"
|
|
5571
|
+
}
|
|
5572
|
+
},
|
|
5502
5573
|
"node_modules/find-up": {
|
|
5503
5574
|
"version": "4.1.0",
|
|
5504
5575
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
|
@@ -7517,6 +7588,26 @@
|
|
|
7517
7588
|
"node": "*"
|
|
7518
7589
|
}
|
|
7519
7590
|
},
|
|
7591
|
+
"node_modules/minimist": {
|
|
7592
|
+
"version": "1.2.8",
|
|
7593
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
|
7594
|
+
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
|
7595
|
+
"dev": true,
|
|
7596
|
+
"license": "MIT",
|
|
7597
|
+
"funding": {
|
|
7598
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
7599
|
+
}
|
|
7600
|
+
},
|
|
7601
|
+
"node_modules/minipass": {
|
|
7602
|
+
"version": "4.2.8",
|
|
7603
|
+
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
|
|
7604
|
+
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
|
|
7605
|
+
"dev": true,
|
|
7606
|
+
"license": "ISC",
|
|
7607
|
+
"engines": {
|
|
7608
|
+
"node": ">=8"
|
|
7609
|
+
}
|
|
7610
|
+
},
|
|
7520
7611
|
"node_modules/moment": {
|
|
7521
7612
|
"version": "2.30.1",
|
|
7522
7613
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
|
@@ -8017,6 +8108,40 @@
|
|
|
8017
8108
|
"dev": true,
|
|
8018
8109
|
"license": "MIT"
|
|
8019
8110
|
},
|
|
8111
|
+
"node_modules/path-scurry": {
|
|
8112
|
+
"version": "1.11.1",
|
|
8113
|
+
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
|
|
8114
|
+
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
|
|
8115
|
+
"dev": true,
|
|
8116
|
+
"license": "BlueOak-1.0.0",
|
|
8117
|
+
"dependencies": {
|
|
8118
|
+
"lru-cache": "^10.2.0",
|
|
8119
|
+
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
|
|
8120
|
+
},
|
|
8121
|
+
"engines": {
|
|
8122
|
+
"node": ">=16 || 14 >=14.18"
|
|
8123
|
+
},
|
|
8124
|
+
"funding": {
|
|
8125
|
+
"url": "https://github.com/sponsors/isaacs"
|
|
8126
|
+
}
|
|
8127
|
+
},
|
|
8128
|
+
"node_modules/path-scurry/node_modules/lru-cache": {
|
|
8129
|
+
"version": "10.4.3",
|
|
8130
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
|
|
8131
|
+
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
|
|
8132
|
+
"dev": true,
|
|
8133
|
+
"license": "ISC"
|
|
8134
|
+
},
|
|
8135
|
+
"node_modules/path-scurry/node_modules/minipass": {
|
|
8136
|
+
"version": "7.1.2",
|
|
8137
|
+
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
|
8138
|
+
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
|
8139
|
+
"dev": true,
|
|
8140
|
+
"license": "ISC",
|
|
8141
|
+
"engines": {
|
|
8142
|
+
"node": ">=16 || 14 >=14.17"
|
|
8143
|
+
}
|
|
8144
|
+
},
|
|
8020
8145
|
"node_modules/path-to-regexp": {
|
|
8021
8146
|
"version": "8.2.0",
|
|
8022
8147
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz",
|
|
@@ -8105,6 +8230,85 @@
|
|
|
8105
8230
|
"pathe": "^2.0.3"
|
|
8106
8231
|
}
|
|
8107
8232
|
},
|
|
8233
|
+
"node_modules/pkg-up": {
|
|
8234
|
+
"version": "3.1.0",
|
|
8235
|
+
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
|
|
8236
|
+
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
|
|
8237
|
+
"dev": true,
|
|
8238
|
+
"license": "MIT",
|
|
8239
|
+
"dependencies": {
|
|
8240
|
+
"find-up": "^3.0.0"
|
|
8241
|
+
},
|
|
8242
|
+
"engines": {
|
|
8243
|
+
"node": ">=8"
|
|
8244
|
+
}
|
|
8245
|
+
},
|
|
8246
|
+
"node_modules/pkg-up/node_modules/find-up": {
|
|
8247
|
+
"version": "3.0.0",
|
|
8248
|
+
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
|
8249
|
+
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
|
8250
|
+
"dev": true,
|
|
8251
|
+
"license": "MIT",
|
|
8252
|
+
"dependencies": {
|
|
8253
|
+
"locate-path": "^3.0.0"
|
|
8254
|
+
},
|
|
8255
|
+
"engines": {
|
|
8256
|
+
"node": ">=6"
|
|
8257
|
+
}
|
|
8258
|
+
},
|
|
8259
|
+
"node_modules/pkg-up/node_modules/locate-path": {
|
|
8260
|
+
"version": "3.0.0",
|
|
8261
|
+
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
|
8262
|
+
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
|
8263
|
+
"dev": true,
|
|
8264
|
+
"license": "MIT",
|
|
8265
|
+
"dependencies": {
|
|
8266
|
+
"p-locate": "^3.0.0",
|
|
8267
|
+
"path-exists": "^3.0.0"
|
|
8268
|
+
},
|
|
8269
|
+
"engines": {
|
|
8270
|
+
"node": ">=6"
|
|
8271
|
+
}
|
|
8272
|
+
},
|
|
8273
|
+
"node_modules/pkg-up/node_modules/p-limit": {
|
|
8274
|
+
"version": "2.3.0",
|
|
8275
|
+
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
|
8276
|
+
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
|
8277
|
+
"dev": true,
|
|
8278
|
+
"license": "MIT",
|
|
8279
|
+
"dependencies": {
|
|
8280
|
+
"p-try": "^2.0.0"
|
|
8281
|
+
},
|
|
8282
|
+
"engines": {
|
|
8283
|
+
"node": ">=6"
|
|
8284
|
+
},
|
|
8285
|
+
"funding": {
|
|
8286
|
+
"url": "https://github.com/sponsors/sindresorhus"
|
|
8287
|
+
}
|
|
8288
|
+
},
|
|
8289
|
+
"node_modules/pkg-up/node_modules/p-locate": {
|
|
8290
|
+
"version": "3.0.0",
|
|
8291
|
+
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
|
8292
|
+
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
|
8293
|
+
"dev": true,
|
|
8294
|
+
"license": "MIT",
|
|
8295
|
+
"dependencies": {
|
|
8296
|
+
"p-limit": "^2.0.0"
|
|
8297
|
+
},
|
|
8298
|
+
"engines": {
|
|
8299
|
+
"node": ">=6"
|
|
8300
|
+
}
|
|
8301
|
+
},
|
|
8302
|
+
"node_modules/pkg-up/node_modules/path-exists": {
|
|
8303
|
+
"version": "3.0.0",
|
|
8304
|
+
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
|
8305
|
+
"integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==",
|
|
8306
|
+
"dev": true,
|
|
8307
|
+
"license": "MIT",
|
|
8308
|
+
"engines": {
|
|
8309
|
+
"node": ">=4"
|
|
8310
|
+
}
|
|
8311
|
+
},
|
|
8108
8312
|
"node_modules/plimit-lit": {
|
|
8109
8313
|
"version": "1.6.1",
|
|
8110
8314
|
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz",
|
|
@@ -8521,6 +8725,13 @@
|
|
|
8521
8725
|
"node": ">=0.10.0"
|
|
8522
8726
|
}
|
|
8523
8727
|
},
|
|
8728
|
+
"node_modules/reselect": {
|
|
8729
|
+
"version": "4.1.8",
|
|
8730
|
+
"resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz",
|
|
8731
|
+
"integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==",
|
|
8732
|
+
"dev": true,
|
|
8733
|
+
"license": "MIT"
|
|
8734
|
+
},
|
|
8524
8735
|
"node_modules/resolve": {
|
|
8525
8736
|
"version": "1.22.10",
|
|
8526
8737
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
|
|
@@ -9496,6 +9707,31 @@
|
|
|
9496
9707
|
"node": "^12.20.0 || >=14"
|
|
9497
9708
|
}
|
|
9498
9709
|
},
|
|
9710
|
+
"node_modules/tsconfig-paths": {
|
|
9711
|
+
"version": "4.2.0",
|
|
9712
|
+
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz",
|
|
9713
|
+
"integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==",
|
|
9714
|
+
"dev": true,
|
|
9715
|
+
"license": "MIT",
|
|
9716
|
+
"dependencies": {
|
|
9717
|
+
"json5": "^2.2.2",
|
|
9718
|
+
"minimist": "^1.2.6",
|
|
9719
|
+
"strip-bom": "^3.0.0"
|
|
9720
|
+
},
|
|
9721
|
+
"engines": {
|
|
9722
|
+
"node": ">=6"
|
|
9723
|
+
}
|
|
9724
|
+
},
|
|
9725
|
+
"node_modules/tsconfig-paths/node_modules/strip-bom": {
|
|
9726
|
+
"version": "3.0.0",
|
|
9727
|
+
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
|
9728
|
+
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
|
|
9729
|
+
"dev": true,
|
|
9730
|
+
"license": "MIT",
|
|
9731
|
+
"engines": {
|
|
9732
|
+
"node": ">=4"
|
|
9733
|
+
}
|
|
9734
|
+
},
|
|
9499
9735
|
"node_modules/tslib": {
|
|
9500
9736
|
"version": "2.8.1",
|
|
9501
9737
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
package/template/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "craftjs",
|
|
3
3
|
"description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.4",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"express",
|
|
7
7
|
"typescript",
|
|
@@ -20,7 +20,23 @@
|
|
|
20
20
|
"jest": {
|
|
21
21
|
"transform": {
|
|
22
22
|
"^.+\\.[t|j]sx?$": "babel-jest"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"moduleNameMapper": {
|
|
25
|
+
"^@config/(.*)$": "<rootDir>/src/config/$1",
|
|
26
|
+
"^@controllers/(.*)$": "<rootDir>/src/controllers/$1",
|
|
27
|
+
"^@services/(.*)$": "<rootDir>/src/services/$1",
|
|
28
|
+
"^@repositories/(.*)$": "<rootDir>/src/repositories/$1",
|
|
29
|
+
"^@routes/(.*)$": "<rootDir>/src/routes/$1",
|
|
30
|
+
"^@middleware/(.*)$": "<rootDir>/src/middleware/$1",
|
|
31
|
+
"^@dtos/(.*)$": "<rootDir>/src/dtos/$1",
|
|
32
|
+
"^@types/(.*)$": "<rootDir>/src/types/$1",
|
|
33
|
+
"^@utils/(.*)$": "<rootDir>/src/utils/$1",
|
|
34
|
+
"^@validations/(.*)$": "<rootDir>/src/validations/$1"
|
|
35
|
+
},
|
|
36
|
+
"testPathIgnorePatterns": [
|
|
37
|
+
"/node_modules/",
|
|
38
|
+
"/craft/"
|
|
39
|
+
]
|
|
24
40
|
},
|
|
25
41
|
"dependencies": {
|
|
26
42
|
"@prisma/adapter-mariadb": "^7.2.0",
|
|
@@ -69,6 +85,7 @@
|
|
|
69
85
|
"@types/swagger-jsdoc": "^6.0.4",
|
|
70
86
|
"@types/swagger-ui-express": "^4.1.8",
|
|
71
87
|
"babel-jest": "^29.7.0",
|
|
88
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
72
89
|
"jest": "^29.7.0",
|
|
73
90
|
"nodemon": "^3.1.9",
|
|
74
91
|
"prettier": "^3.5.3",
|
|
@@ -77,6 +94,7 @@
|
|
|
77
94
|
"ts-jest": "^29.3.4",
|
|
78
95
|
"ts-node": "^10.9.2",
|
|
79
96
|
"tsc-alias": "^1.8.16",
|
|
97
|
+
"tsconfig-paths": "^4.2.0",
|
|
80
98
|
"tsx": "^4.19.4",
|
|
81
99
|
"typescript": "^5.8.3"
|
|
82
100
|
}
|
|
@@ -3,8 +3,8 @@ import { env } from "./src/config/env";
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
schema: "prisma/schema.prisma",
|
|
5
5
|
migrations: {
|
|
6
|
-
path: "
|
|
7
|
-
seed: "ts-node
|
|
6
|
+
path: "src/database/migrations",
|
|
7
|
+
seed: "ts-node -r tsconfig-paths/register src/database/seeders/seed.ts",
|
|
8
8
|
},
|
|
9
9
|
datasource: {
|
|
10
10
|
url: env.DATABASE_URL,
|
|
@@ -17,10 +17,13 @@
|
|
|
17
17
|
* properties:
|
|
18
18
|
* full_name:
|
|
19
19
|
* type: string
|
|
20
|
+
* example: John Doe
|
|
20
21
|
* email:
|
|
21
22
|
* type: string
|
|
23
|
+
* example: john@example.com
|
|
22
24
|
* password:
|
|
23
25
|
* type: string
|
|
26
|
+
* example: 12345678
|
|
24
27
|
* responses:
|
|
25
28
|
* 201:
|
|
26
29
|
* description: Register berhasil
|
|
@@ -31,8 +34,10 @@
|
|
|
31
34
|
* properties:
|
|
32
35
|
* status:
|
|
33
36
|
* type: boolean
|
|
37
|
+
* example: true
|
|
34
38
|
* status_code:
|
|
35
|
-
*
|
|
39
|
+
* type: integer
|
|
40
|
+
* example: 201
|
|
36
41
|
* message:
|
|
37
42
|
* type: string
|
|
38
43
|
* example: Register Berhasil
|
|
@@ -48,20 +53,6 @@
|
|
|
48
53
|
* type: string
|
|
49
54
|
* 400:
|
|
50
55
|
* $ref: '#/components/responses/ValidationError'
|
|
51
|
-
* 409:
|
|
52
|
-
* description: Konflik - akun sudah terdaftar
|
|
53
|
-
* content:
|
|
54
|
-
* application/json:
|
|
55
|
-
* schema:
|
|
56
|
-
* type: object
|
|
57
|
-
* properties:
|
|
58
|
-
* status:
|
|
59
|
-
* type: boolean
|
|
60
|
-
* status_code:
|
|
61
|
-
* type: integer
|
|
62
|
-
* message:
|
|
63
|
-
* type: string
|
|
64
|
-
* example: Akun Sudah Terdaftar!
|
|
65
56
|
*/
|
|
66
57
|
/**
|
|
67
58
|
* @swagger
|
|
@@ -235,60 +226,3 @@
|
|
|
235
226
|
* 401:
|
|
236
227
|
* $ref: '#/components/responses/UnauthorizedNotLoginError'
|
|
237
228
|
*/
|
|
238
|
-
// Update profile
|
|
239
|
-
/**
|
|
240
|
-
* @swagger
|
|
241
|
-
* /api/auth/update-profile:
|
|
242
|
-
* put:
|
|
243
|
-
* summary: Memperbarui profil pengguna yang sedang login
|
|
244
|
-
* tags: [Auth]
|
|
245
|
-
* security:
|
|
246
|
-
* - bearerAuth: []
|
|
247
|
-
* requestBody:
|
|
248
|
-
* required: true
|
|
249
|
-
* content:
|
|
250
|
-
* application/json:
|
|
251
|
-
* schema:
|
|
252
|
-
* type: object
|
|
253
|
-
* properties:
|
|
254
|
-
* full_name:
|
|
255
|
-
* type: string
|
|
256
|
-
* example: tes
|
|
257
|
-
* email:
|
|
258
|
-
* type: string
|
|
259
|
-
* example: tes@gmail.com
|
|
260
|
-
* responses:
|
|
261
|
-
* 200:
|
|
262
|
-
* description: Data Berhasil Diupdate
|
|
263
|
-
* content:
|
|
264
|
-
* application/json:
|
|
265
|
-
* schema:
|
|
266
|
-
* type: object
|
|
267
|
-
* properties:
|
|
268
|
-
* status:
|
|
269
|
-
* type: boolean
|
|
270
|
-
* example: true
|
|
271
|
-
* status_code:
|
|
272
|
-
* type: integer
|
|
273
|
-
* example: 200
|
|
274
|
-
* message:
|
|
275
|
-
* type: string
|
|
276
|
-
* example: Data Berhasil Diupdate
|
|
277
|
-
* data:
|
|
278
|
-
* type: object
|
|
279
|
-
* properties:
|
|
280
|
-
* id:
|
|
281
|
-
* type: string
|
|
282
|
-
* format: uuid
|
|
283
|
-
* example: c1fa015f-48b0-456f-8c41-baf54ce092f5
|
|
284
|
-
* full_name:
|
|
285
|
-
* type: string
|
|
286
|
-
* example: tes update
|
|
287
|
-
* email:
|
|
288
|
-
* type: string
|
|
289
|
-
* example: tes@gmail.com
|
|
290
|
-
* 400:
|
|
291
|
-
* $ref: '#/components/responses/ValidationError'
|
|
292
|
-
* 401:
|
|
293
|
-
* $ref: '#/components/responses/UnauthorizedATError'
|
|
294
|
-
*/
|
|
@@ -144,17 +144,18 @@
|
|
|
144
144
|
* schema:
|
|
145
145
|
* type: object
|
|
146
146
|
* properties:
|
|
147
|
-
* status: { type: boolean }
|
|
148
|
-
* status_code: { type: integer }
|
|
149
|
-
* message: { type: string }
|
|
147
|
+
* status: { type: boolean, example: true }
|
|
148
|
+
* status_code: { type: integer, example: 200 }
|
|
149
|
+
* message: { type: string, example: Berhasil Get Detail Data }
|
|
150
150
|
* data:
|
|
151
151
|
* type: object
|
|
152
152
|
* properties:
|
|
153
153
|
* id: { type: string, format: uuid }
|
|
154
|
-
* full_name: { type: string }
|
|
155
|
-
* email: { type: string, format: email }
|
|
156
|
-
*
|
|
157
|
-
*
|
|
154
|
+
* full_name: { type: string, example: John Doe }
|
|
155
|
+
* email: { type: string, format: email, example: johndoe@example.com }
|
|
156
|
+
* created_at: { type: string, format: datetime, example: 18-01-2026 21:55:22 }
|
|
157
|
+
* updated_at: { type: string, format: datetime, example: 18-01-2026 21:55:22 }
|
|
158
|
+
* deleted_at: { type: string, format: datetime, example: 18-01-2026 21:55:22, nullable: true }
|
|
158
159
|
*/
|
|
159
160
|
/**
|
|
160
161
|
* @swagger
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { prismaClient } from "
|
|
1
|
+
import { prismaClient } from "../../config/database";
|
|
2
2
|
import * as argon2 from "argon2";
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
4
|
|
|
5
5
|
dotenv.config();
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
async function main() {
|
|
9
8
|
await prismaClient.user.upsert({
|
|
10
9
|
where: { email: "tes@gmail.com" },
|
|
11
10
|
update: {},
|
|
12
11
|
create: {
|
|
13
|
-
full_name: "
|
|
12
|
+
full_name: "Akun Test",
|
|
14
13
|
email: "tes@gmail.com",
|
|
15
|
-
password: await argon2.hash("
|
|
14
|
+
password: await argon2.hash("123456"),
|
|
16
15
|
},
|
|
17
16
|
});
|
|
18
17
|
|
|
19
|
-
console.log("Users seeded");
|
|
18
|
+
console.log("Users seeded Successfully");
|
|
20
19
|
}
|
|
21
20
|
main()
|
|
22
21
|
.catch((e) => {
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
UserResponse,
|
|
7
7
|
toUserListItemResponse,
|
|
8
8
|
UserListItemResponse,
|
|
9
|
+
toUserDetailResponse,
|
|
10
|
+
UserDetailResponse,
|
|
9
11
|
} from "@dtos/user-dto";
|
|
10
12
|
import { ResponseError } from "@utils/response-error";
|
|
11
13
|
import { UserValidation } from "@validations/user-validation";
|
|
@@ -88,12 +90,12 @@ export class UserService {
|
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
static async detail(id: string): Promise<
|
|
93
|
+
static async detail(id: string): Promise<UserDetailResponse> {
|
|
92
94
|
const data = await UserRepository.findById(id);
|
|
93
95
|
if (!data) {
|
|
94
96
|
throw new ResponseError(404, "Data Tidak Ditemukan");
|
|
95
97
|
}
|
|
96
|
-
return
|
|
98
|
+
return toUserDetailResponse(data);
|
|
97
99
|
}
|
|
98
100
|
static async update(
|
|
99
101
|
id: string,
|
|
@@ -25,10 +25,9 @@ export class UserValidation {
|
|
|
25
25
|
(v) => (v === null ? undefined : v),
|
|
26
26
|
z
|
|
27
27
|
.string({
|
|
28
|
-
required_error: "
|
|
28
|
+
required_error: "Password Wajib Diisi",
|
|
29
29
|
})
|
|
30
|
-
.min(
|
|
31
|
-
.max(100, { message: "Kata Sandi Maksimal 100 Karakter" })
|
|
30
|
+
.min(6, { message: "Password Minimal 6 Karakter" })
|
|
32
31
|
),
|
|
33
32
|
});
|
|
34
33
|
|
|
@@ -56,10 +55,9 @@ export class UserValidation {
|
|
|
56
55
|
(v) => (v === null ? undefined : v),
|
|
57
56
|
z
|
|
58
57
|
.string({
|
|
59
|
-
required_error: "
|
|
58
|
+
required_error: "Password Wajib Diisi",
|
|
60
59
|
})
|
|
61
|
-
.min(
|
|
62
|
-
.max(100, { message: "Kata Sandi Maksimal 100 Karakter" })
|
|
60
|
+
.min(6, { message: "Password Minimal 6 Karakter" })
|
|
63
61
|
),
|
|
64
62
|
});
|
|
65
63
|
|
|
@@ -77,10 +75,9 @@ export class UserValidation {
|
|
|
77
75
|
(v) => (v === null ? undefined : v),
|
|
78
76
|
z
|
|
79
77
|
.string({
|
|
80
|
-
required_error: "
|
|
78
|
+
required_error: "Password Wajib Diisi",
|
|
81
79
|
})
|
|
82
|
-
.min(
|
|
83
|
-
.max(100, { message: "Kata Sandi Maksimal 100 Karakter" })
|
|
80
|
+
.min(6, { message: "Password Minimal 6 Karakter" })
|
|
84
81
|
),
|
|
85
82
|
});
|
|
86
83
|
|
/package/template/{prisma → src/database}/migrations/20250518142257_create_table_users/migration.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|