@wipzent/github-sync 1.0.1

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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/dist/cli/index.js +185 -0
  4. package/dist/cli/prompts.js +16 -0
  5. package/dist/config/defaults.js +5 -0
  6. package/dist/config/env.js +23 -0
  7. package/dist/config/octokit.js +14 -0
  8. package/dist/git/clone.js +15 -0
  9. package/dist/git/rewriteAuthor.js +37 -0
  10. package/dist/git/sync.js +141 -0
  11. package/dist/mcp/resources/github.js +13 -0
  12. package/dist/mcp/server.js +92 -0
  13. package/dist/mcp/tools/autoSync.js +130 -0
  14. package/dist/mcp/tools/createRepo.js +120 -0
  15. package/dist/mcp/tools/resolveConflict.js +4 -0
  16. package/dist/mcp/tools/syncRepo.js +21 -0
  17. package/dist/temp/Terred-Mujtaba-/apps/app/src/components/Toaster/toast.js +17 -0
  18. package/dist/temp/Terred-Mujtaba-/apps/app/src/config/fetch.js +76 -0
  19. package/dist/temp/Terred-Mujtaba-/apps/app/src/config/index.js +65 -0
  20. package/dist/temp/Terred-Mujtaba-/apps/app/src/data/data.js +574 -0
  21. package/dist/temp/Terred-Mujtaba-/apps/app/src/lib/utils.js +8 -0
  22. package/dist/temp/Terred-Mujtaba-/apps/app/src/redux/config.js +7 -0
  23. package/dist/temp/Terred-Mujtaba-/apps/app/src/redux/slices/AdminsSlice.js +20 -0
  24. package/dist/temp/Terred-Mujtaba-/apps/app/src/redux/slices/userSlice.js +19 -0
  25. package/dist/temp/Terred-Mujtaba-/apps/app/src/redux/store.js +15 -0
  26. package/dist/temp/Terred-Mujtaba-/apps/app/src/types/interfaces.js +3 -0
  27. package/dist/temp/Terred-Mujtaba-/apps/app/src/types/types.js +2 -0
  28. package/dist/temp/Terred-Mujtaba-/apps/app/src/utils/helperFunctions.js +150 -0
  29. package/dist/temp/Terred-Mujtaba-/apps/app/tailwind.config.js +85 -0
  30. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/admin.controller.js +113 -0
  31. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/admin.controller.spec.js +18 -0
  32. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/admin.module.js +64 -0
  33. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/admin.service.js +327 -0
  34. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/admin.service.spec.js +16 -0
  35. package/dist/temp/Terred-Mujtaba-/apps/backend/src/admin/dto/admin.dto.js +214 -0
  36. package/dist/temp/Terred-Mujtaba-/apps/backend/src/app.controller.js +67 -0
  37. package/dist/temp/Terred-Mujtaba-/apps/backend/src/app.controller.spec.js +20 -0
  38. package/dist/temp/Terred-Mujtaba-/apps/backend/src/app.module.js +67 -0
  39. package/dist/temp/Terred-Mujtaba-/apps/backend/src/app.service.js +60 -0
  40. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/categories.controller.js +89 -0
  41. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/categories.controller.spec.js +18 -0
  42. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/categories.module.js +64 -0
  43. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/categories.service.js +173 -0
  44. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/categories.service.spec.js +16 -0
  45. package/dist/temp/Terred-Mujtaba-/apps/backend/src/categories/dto/category.dto.js +128 -0
  46. package/dist/temp/Terred-Mujtaba-/apps/backend/src/cloudinary/cloudinary.controller.js +86 -0
  47. package/dist/temp/Terred-Mujtaba-/apps/backend/src/cloudinary/cloudinary.controller.spec.js +18 -0
  48. package/dist/temp/Terred-Mujtaba-/apps/backend/src/cloudinary/cloudinary.module.js +63 -0
  49. package/dist/temp/Terred-Mujtaba-/apps/backend/src/cloudinary/cloudinary.service.js +132 -0
  50. package/dist/temp/Terred-Mujtaba-/apps/backend/src/cloudinary/cloudinary.service.spec.js +16 -0
  51. package/dist/temp/Terred-Mujtaba-/apps/backend/src/config/index.js +2 -0
  52. package/dist/temp/Terred-Mujtaba-/apps/backend/src/main.js +30 -0
  53. package/dist/temp/Terred-Mujtaba-/apps/backend/src/prisma/prisma.module.js +60 -0
  54. package/dist/temp/Terred-Mujtaba-/apps/backend/src/prisma/prisma.service.js +58 -0
  55. package/dist/temp/Terred-Mujtaba-/apps/backend/src/prisma/prisma.service.spec.js +16 -0
  56. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/dto/product.dto.js +124 -0
  57. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/products.controller.js +89 -0
  58. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/products.controller.spec.js +18 -0
  59. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/products.module.js +64 -0
  60. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/products.service.js +170 -0
  61. package/dist/temp/Terred-Mujtaba-/apps/backend/src/products/products.service.spec.js +16 -0
  62. package/dist/temp/Terred-Mujtaba-/apps/backend/src/types/index.js +2 -0
  63. package/dist/temp/Terred-Mujtaba-/apps/backend/src/utils/func.js +79 -0
  64. package/dist/temp/Terred-Mujtaba-/apps/backend/src/utils/helper.js +31 -0
  65. package/dist/temp/Terred-Mujtaba-/apps/backend/test/app.e2e-spec.js +54 -0
  66. package/dist/temp/Terred-Mujtaba-/packages/ui/turbo/generators/config.js +30 -0
  67. package/package.json +47 -0
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.CloudinaryController = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const platform_express_1 = require("@nestjs/platform-express");
40
+ let CloudinaryController = (() => {
41
+ let _classDecorators = [(0, common_1.Controller)('cloudinary')];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ let _instanceExtraInitializers = [];
46
+ let _uploadImage_decorators;
47
+ let _deleteImage_decorators;
48
+ let _uploadVideo_decorators;
49
+ let _deleteVideo_decorators;
50
+ var CloudinaryController = class {
51
+ static { _classThis = this; }
52
+ static {
53
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
54
+ _uploadImage_decorators = [(0, common_1.Post)('upload-image'), (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('file'))];
55
+ _deleteImage_decorators = [(0, common_1.Delete)('/remove-image/:publicId')];
56
+ _uploadVideo_decorators = [(0, common_1.Post)('upload-video'), (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('file'))];
57
+ _deleteVideo_decorators = [(0, common_1.Delete)('/remove-video/:publicId')];
58
+ __esDecorate(this, null, _uploadImage_decorators, { kind: "method", name: "uploadImage", static: false, private: false, access: { has: obj => "uploadImage" in obj, get: obj => obj.uploadImage }, metadata: _metadata }, null, _instanceExtraInitializers);
59
+ __esDecorate(this, null, _deleteImage_decorators, { kind: "method", name: "deleteImage", static: false, private: false, access: { has: obj => "deleteImage" in obj, get: obj => obj.deleteImage }, metadata: _metadata }, null, _instanceExtraInitializers);
60
+ __esDecorate(this, null, _uploadVideo_decorators, { kind: "method", name: "uploadVideo", static: false, private: false, access: { has: obj => "uploadVideo" in obj, get: obj => obj.uploadVideo }, metadata: _metadata }, null, _instanceExtraInitializers);
61
+ __esDecorate(this, null, _deleteVideo_decorators, { kind: "method", name: "deleteVideo", static: false, private: false, access: { has: obj => "deleteVideo" in obj, get: obj => obj.deleteVideo }, metadata: _metadata }, null, _instanceExtraInitializers);
62
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
63
+ CloudinaryController = _classThis = _classDescriptor.value;
64
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
65
+ __runInitializers(_classThis, _classExtraInitializers);
66
+ }
67
+ cloudinaryService = __runInitializers(this, _instanceExtraInitializers);
68
+ constructor(cloudinaryService) {
69
+ this.cloudinaryService = cloudinaryService;
70
+ }
71
+ async uploadImage(file) {
72
+ return this.cloudinaryService.uploadImage(file);
73
+ }
74
+ async deleteImage(publicId) {
75
+ return this.cloudinaryService.deleteImage(publicId);
76
+ }
77
+ async uploadVideo(file) {
78
+ return this.cloudinaryService.uploadVideo(file);
79
+ }
80
+ async deleteVideo(publicId) {
81
+ return this.cloudinaryService.deleteVideo(publicId);
82
+ }
83
+ };
84
+ return CloudinaryController = _classThis;
85
+ })();
86
+ exports.CloudinaryController = CloudinaryController;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testing_1 = require("@nestjs/testing");
4
+ const cloudinary_controller_1 = require("./cloudinary.controller");
5
+ const cloudinary_service_1 = require("./cloudinary.service");
6
+ describe('CloudinaryController', () => {
7
+ let controller;
8
+ beforeEach(async () => {
9
+ const module = await testing_1.Test.createTestingModule({
10
+ controllers: [cloudinary_controller_1.CloudinaryController],
11
+ providers: [cloudinary_service_1.CloudinaryService],
12
+ }).compile();
13
+ controller = module.get(cloudinary_controller_1.CloudinaryController);
14
+ });
15
+ it('should be defined', () => {
16
+ expect(controller).toBeDefined();
17
+ });
18
+ });
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.CloudinaryModule = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const cloudinary_service_1 = require("./cloudinary.service");
40
+ const cloudinary_controller_1 = require("./cloudinary.controller");
41
+ const config_1 = require("@nestjs/config");
42
+ let CloudinaryModule = (() => {
43
+ let _classDecorators = [(0, common_1.Module)({
44
+ controllers: [cloudinary_controller_1.CloudinaryController],
45
+ providers: [cloudinary_service_1.CloudinaryService],
46
+ imports: [config_1.ConfigModule],
47
+ })];
48
+ let _classDescriptor;
49
+ let _classExtraInitializers = [];
50
+ let _classThis;
51
+ var CloudinaryModule = class {
52
+ static { _classThis = this; }
53
+ static {
54
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
55
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
+ CloudinaryModule = _classThis = _classDescriptor.value;
57
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
+ __runInitializers(_classThis, _classExtraInitializers);
59
+ }
60
+ };
61
+ return CloudinaryModule = _classThis;
62
+ })();
63
+ exports.CloudinaryModule = CloudinaryModule;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.CloudinaryService = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const cloudinary_1 = require("cloudinary");
40
+ let CloudinaryService = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var CloudinaryService = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ CloudinaryService = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ configService;
55
+ constructor(configService) {
56
+ this.configService = configService;
57
+ cloudinary_1.v2.config({
58
+ cloud_name: this.configService.get('CLOUDINARY_CLOUD_NAME'),
59
+ api_key: this.configService.get('CLOUDINARY_API_KEY'),
60
+ api_secret: this.configService.get('CLOUDINARY_API_SECRET'),
61
+ });
62
+ }
63
+ async uploadImage(file) {
64
+ return new Promise((resolve, reject) => {
65
+ cloudinary_1.v2.uploader
66
+ .upload_stream((error, result) => {
67
+ if (error) {
68
+ reject(error);
69
+ }
70
+ else {
71
+ resolve({
72
+ imageUrl: result.secure_url,
73
+ publicId: result.public_id,
74
+ });
75
+ }
76
+ })
77
+ .end(file.buffer);
78
+ });
79
+ }
80
+ async deleteImage(publicId) {
81
+ return new Promise((resolve, reject) => {
82
+ cloudinary_1.v2.uploader.destroy(publicId, (error, result) => {
83
+ if (error) {
84
+ reject(error);
85
+ }
86
+ else {
87
+ resolve({
88
+ message: result.result === 'ok'
89
+ ? 'Image deleted successfully 🎉'
90
+ : 'Image not found 😢',
91
+ });
92
+ }
93
+ });
94
+ });
95
+ }
96
+ async uploadVideo(file) {
97
+ return new Promise((resolve, reject) => {
98
+ cloudinary_1.v2.uploader
99
+ .upload_stream({ resource_type: 'video' }, (error, result) => {
100
+ if (error) {
101
+ reject(error);
102
+ }
103
+ else {
104
+ resolve({
105
+ videoUrl: result.secure_url,
106
+ publicId: result.public_id,
107
+ });
108
+ }
109
+ })
110
+ .end(file.buffer);
111
+ });
112
+ }
113
+ async deleteVideo(publicId) {
114
+ return new Promise((resolve, reject) => {
115
+ cloudinary_1.v2.uploader.destroy(publicId, { resource_type: 'video' }, (error, result) => {
116
+ if (error) {
117
+ reject(error);
118
+ }
119
+ else {
120
+ resolve({
121
+ message: result.result === 'ok'
122
+ ? 'Video deleted successfully🎉'
123
+ : 'Video not found 😢',
124
+ });
125
+ }
126
+ });
127
+ });
128
+ }
129
+ };
130
+ return CloudinaryService = _classThis;
131
+ })();
132
+ exports.CloudinaryService = CloudinaryService;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testing_1 = require("@nestjs/testing");
4
+ const cloudinary_service_1 = require("./cloudinary.service");
5
+ describe('CloudinaryService', () => {
6
+ let service;
7
+ beforeEach(async () => {
8
+ const module = await testing_1.Test.createTestingModule({
9
+ providers: [cloudinary_service_1.CloudinaryService],
10
+ }).compile();
11
+ service = module.get(cloudinary_service_1.CloudinaryService);
12
+ });
13
+ it('should be defined', () => {
14
+ expect(service).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const core_1 = require("@nestjs/core");
7
+ const app_module_1 = require("./app.module");
8
+ const swagger_1 = require("@nestjs/swagger");
9
+ const common_1 = require("@nestjs/common");
10
+ const cookie_parser_1 = __importDefault(require("cookie-parser"));
11
+ async function bootstrap() {
12
+ const app = await core_1.NestFactory.create(app_module_1.AppModule);
13
+ app.enableCors({
14
+ origin: ['http://localhost:3000'],
15
+ methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
16
+ preflightContinue: false,
17
+ });
18
+ app.setGlobalPrefix('api');
19
+ app.useGlobalPipes(new common_1.ValidationPipe());
20
+ app.use((0, cookie_parser_1.default)());
21
+ const config = new swagger_1.DocumentBuilder()
22
+ .setTitle('Avenue39')
23
+ .setDescription('The Avenue39 API description')
24
+ .setVersion('0.1')
25
+ .build();
26
+ const document = swagger_1.SwaggerModule.createDocument(app, config);
27
+ swagger_1.SwaggerModule.setup('docs', app, document);
28
+ await app.listen(process.env.PORT || 3300);
29
+ }
30
+ bootstrap();
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.PrismaModule = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const prisma_service_1 = require("./prisma.service");
40
+ let PrismaModule = (() => {
41
+ let _classDecorators = [(0, common_1.Module)({
42
+ providers: [prisma_service_1.PrismaService],
43
+ exports: [prisma_service_1.PrismaService],
44
+ })];
45
+ let _classDescriptor;
46
+ let _classExtraInitializers = [];
47
+ let _classThis;
48
+ var PrismaModule = class {
49
+ static { _classThis = this; }
50
+ static {
51
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
52
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
53
+ PrismaModule = _classThis = _classDescriptor.value;
54
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
+ __runInitializers(_classThis, _classExtraInitializers);
56
+ }
57
+ };
58
+ return PrismaModule = _classThis;
59
+ })();
60
+ exports.PrismaModule = PrismaModule;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.PrismaService = void 0;
38
+ const common_1 = require("@nestjs/common");
39
+ const client_1 = require("@prisma/client");
40
+ let PrismaService = (() => {
41
+ let _classDecorators = [(0, common_1.Injectable)()];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ let _classSuper = client_1.PrismaClient;
46
+ var PrismaService = class extends _classSuper {
47
+ static { _classThis = this; }
48
+ static {
49
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
50
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
51
+ PrismaService = _classThis = _classDescriptor.value;
52
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
53
+ __runInitializers(_classThis, _classExtraInitializers);
54
+ }
55
+ };
56
+ return PrismaService = _classThis;
57
+ })();
58
+ exports.PrismaService = PrismaService;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testing_1 = require("@nestjs/testing");
4
+ const prisma_service_1 = require("./prisma.service");
5
+ describe('PrismaService', () => {
6
+ let service;
7
+ beforeEach(async () => {
8
+ const module = await testing_1.Test.createTestingModule({
9
+ providers: [prisma_service_1.PrismaService],
10
+ }).compile();
11
+ service = module.get(prisma_service_1.PrismaService);
12
+ });
13
+ it('should be defined', () => {
14
+ expect(service).toBeDefined();
15
+ });
16
+ });
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.UpdateProductDto = exports.AddProductDto = void 0;
38
+ const class_validator_1 = require("class-validator");
39
+ let AddProductDto = (() => {
40
+ let _name_decorators;
41
+ let _name_initializers = [];
42
+ let _name_extraInitializers = [];
43
+ let _price_decorators;
44
+ let _price_initializers = [];
45
+ let _price_extraInitializers = [];
46
+ let _description_decorators;
47
+ let _description_initializers = [];
48
+ let _description_extraInitializers = [];
49
+ let _posterImageUrl_decorators;
50
+ let _posterImageUrl_initializers = [];
51
+ let _posterImageUrl_extraInitializers = [];
52
+ let _posterImagePublicId_decorators;
53
+ let _posterImagePublicId_initializers = [];
54
+ let _posterImagePublicId_extraInitializers = [];
55
+ let _videoUrl_decorators;
56
+ let _videoUrl_initializers = [];
57
+ let _videoUrl_extraInitializers = [];
58
+ let _videoPublicId_decorators;
59
+ let _videoPublicId_initializers = [];
60
+ let _videoPublicId_extraInitializers = [];
61
+ let _productImages_decorators;
62
+ let _productImages_initializers = [];
63
+ let _productImages_extraInitializers = [];
64
+ let _categories_decorators;
65
+ let _categories_initializers = [];
66
+ let _categories_extraInitializers = [];
67
+ return class AddProductDto {
68
+ static {
69
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
70
+ _name_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsString)()];
71
+ _price_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsInt)()];
72
+ _description_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsString)()];
73
+ _posterImageUrl_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsString)()];
74
+ _posterImagePublicId_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsString)()];
75
+ _videoUrl_decorators = [(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
76
+ _videoPublicId_decorators = [(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)()];
77
+ _productImages_decorators = [(0, class_validator_1.IsOptional)(), (0, class_validator_1.IsArray)()];
78
+ _categories_decorators = [(0, class_validator_1.IsNotEmpty)(), (0, class_validator_1.IsArray)(), (0, class_validator_1.ArrayNotEmpty)(), (0, class_validator_1.IsInt)({ each: true })];
79
+ __esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
80
+ __esDecorate(null, null, _price_decorators, { kind: "field", name: "price", static: false, private: false, access: { has: obj => "price" in obj, get: obj => obj.price, set: (obj, value) => { obj.price = value; } }, metadata: _metadata }, _price_initializers, _price_extraInitializers);
81
+ __esDecorate(null, null, _description_decorators, { kind: "field", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
82
+ __esDecorate(null, null, _posterImageUrl_decorators, { kind: "field", name: "posterImageUrl", static: false, private: false, access: { has: obj => "posterImageUrl" in obj, get: obj => obj.posterImageUrl, set: (obj, value) => { obj.posterImageUrl = value; } }, metadata: _metadata }, _posterImageUrl_initializers, _posterImageUrl_extraInitializers);
83
+ __esDecorate(null, null, _posterImagePublicId_decorators, { kind: "field", name: "posterImagePublicId", static: false, private: false, access: { has: obj => "posterImagePublicId" in obj, get: obj => obj.posterImagePublicId, set: (obj, value) => { obj.posterImagePublicId = value; } }, metadata: _metadata }, _posterImagePublicId_initializers, _posterImagePublicId_extraInitializers);
84
+ __esDecorate(null, null, _videoUrl_decorators, { kind: "field", name: "videoUrl", static: false, private: false, access: { has: obj => "videoUrl" in obj, get: obj => obj.videoUrl, set: (obj, value) => { obj.videoUrl = value; } }, metadata: _metadata }, _videoUrl_initializers, _videoUrl_extraInitializers);
85
+ __esDecorate(null, null, _videoPublicId_decorators, { kind: "field", name: "videoPublicId", static: false, private: false, access: { has: obj => "videoPublicId" in obj, get: obj => obj.videoPublicId, set: (obj, value) => { obj.videoPublicId = value; } }, metadata: _metadata }, _videoPublicId_initializers, _videoPublicId_extraInitializers);
86
+ __esDecorate(null, null, _productImages_decorators, { kind: "field", name: "productImages", static: false, private: false, access: { has: obj => "productImages" in obj, get: obj => obj.productImages, set: (obj, value) => { obj.productImages = value; } }, metadata: _metadata }, _productImages_initializers, _productImages_extraInitializers);
87
+ __esDecorate(null, null, _categories_decorators, { kind: "field", name: "categories", static: false, private: false, access: { has: obj => "categories" in obj, get: obj => obj.categories, set: (obj, value) => { obj.categories = value; } }, metadata: _metadata }, _categories_initializers, _categories_extraInitializers);
88
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
89
+ }
90
+ name = __runInitializers(this, _name_initializers, void 0);
91
+ price = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _price_initializers, void 0));
92
+ description = (__runInitializers(this, _price_extraInitializers), __runInitializers(this, _description_initializers, void 0));
93
+ posterImageUrl = (__runInitializers(this, _description_extraInitializers), __runInitializers(this, _posterImageUrl_initializers, void 0));
94
+ posterImagePublicId = (__runInitializers(this, _posterImageUrl_extraInitializers), __runInitializers(this, _posterImagePublicId_initializers, void 0));
95
+ videoUrl = (__runInitializers(this, _posterImagePublicId_extraInitializers), __runInitializers(this, _videoUrl_initializers, void 0));
96
+ videoPublicId = (__runInitializers(this, _videoUrl_extraInitializers), __runInitializers(this, _videoPublicId_initializers, void 0));
97
+ productImages = (__runInitializers(this, _videoPublicId_extraInitializers), __runInitializers(this, _productImages_initializers, void 0));
98
+ categories = (__runInitializers(this, _productImages_extraInitializers), __runInitializers(this, _categories_initializers, void 0));
99
+ constructor() {
100
+ __runInitializers(this, _categories_extraInitializers);
101
+ }
102
+ };
103
+ })();
104
+ exports.AddProductDto = AddProductDto;
105
+ let UpdateProductDto = (() => {
106
+ let _classSuper = AddProductDto;
107
+ let _id_decorators;
108
+ let _id_initializers = [];
109
+ let _id_extraInitializers = [];
110
+ return class UpdateProductDto extends _classSuper {
111
+ static {
112
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
113
+ _id_decorators = [(0, class_validator_1.IsNumber)(), (0, class_validator_1.IsNotEmpty)()];
114
+ __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
115
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
116
+ }
117
+ id = __runInitializers(this, _id_initializers, void 0);
118
+ constructor() {
119
+ super(...arguments);
120
+ __runInitializers(this, _id_extraInitializers);
121
+ }
122
+ };
123
+ })();
124
+ exports.UpdateProductDto = UpdateProductDto;