@loopstack/api 0.0.2
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/controllers/auth.controller.d.ts +9 -0
- package/dist/controllers/auth.controller.js +61 -0
- package/dist/controllers/auth.controller.js.map +1 -0
- package/dist/controllers/config.controller.d.ts +9 -0
- package/dist/controllers/config.controller.js +72 -0
- package/dist/controllers/config.controller.js.map +1 -0
- package/dist/controllers/document.controller.d.ts +11 -0
- package/dist/controllers/document.controller.js +131 -0
- package/dist/controllers/document.controller.js.map +1 -0
- package/dist/controllers/namespace.controller.d.ts +11 -0
- package/dist/controllers/namespace.controller.js +131 -0
- package/dist/controllers/namespace.controller.js.map +1 -0
- package/dist/controllers/processor.controller.d.ts +11 -0
- package/dist/controllers/processor.controller.js +97 -0
- package/dist/controllers/processor.controller.js.map +1 -0
- package/dist/controllers/project.controller.d.ts +25 -0
- package/dist/controllers/project.controller.js +272 -0
- package/dist/controllers/project.controller.js.map +1 -0
- package/dist/controllers/workflow.controller.d.ts +12 -0
- package/dist/controllers/workflow.controller.js +148 -0
- package/dist/controllers/workflow.controller.js.map +1 -0
- package/dist/controllers/workspace.controller.d.ts +25 -0
- package/dist/controllers/workspace.controller.js +285 -0
- package/dist/controllers/workspace.controller.js.map +1 -0
- package/dist/decorators/api-paginated-response.decorator.d.ts +2 -0
- package/dist/decorators/api-paginated-response.decorator.js +26 -0
- package/dist/decorators/api-paginated-response.decorator.js.map +1 -0
- package/dist/dtos/document-content.dto.d.ts +2 -0
- package/dist/dtos/document-content.dto.js +7 -0
- package/dist/dtos/document-content.dto.js.map +1 -0
- package/dist/dtos/document-filter.dto.d.ts +3 -0
- package/dist/dtos/document-filter.dto.js +25 -0
- package/dist/dtos/document-filter.dto.js.map +1 -0
- package/dist/dtos/document-item.dto.d.ts +26 -0
- package/dist/dtos/document-item.dto.js +202 -0
- package/dist/dtos/document-item.dto.js.map +1 -0
- package/dist/dtos/document-meta.dto.d.ts +2 -0
- package/dist/dtos/document-meta.dto.js +7 -0
- package/dist/dtos/document-meta.dto.js.map +1 -0
- package/dist/dtos/document-query-dto.d.ts +8 -0
- package/dist/dtos/document-query-dto.js +56 -0
- package/dist/dtos/document-query-dto.js.map +1 -0
- package/dist/dtos/document-sort-by.dto.d.ts +6 -0
- package/dist/dtos/document-sort-by.dto.js +31 -0
- package/dist/dtos/document-sort-by.dto.js.map +1 -0
- package/dist/dtos/document.dto.d.ts +27 -0
- package/dist/dtos/document.dto.js +209 -0
- package/dist/dtos/document.dto.js.map +1 -0
- package/dist/dtos/namespace-filter.dto.d.ts +4 -0
- package/dist/dtos/namespace-filter.dto.js +32 -0
- package/dist/dtos/namespace-filter.dto.js.map +1 -0
- package/dist/dtos/namespace-item.dto.d.ts +8 -0
- package/dist/dtos/namespace-item.dto.js +62 -0
- package/dist/dtos/namespace-item.dto.js.map +1 -0
- package/dist/dtos/namespace-sort-by.dto.d.ts +6 -0
- package/dist/dtos/namespace-sort-by.dto.js +31 -0
- package/dist/dtos/namespace-sort-by.dto.js.map +1 -0
- package/dist/dtos/namespace.dto.d.ts +11 -0
- package/dist/dtos/namespace.dto.js +87 -0
- package/dist/dtos/namespace.dto.js.map +1 -0
- package/dist/dtos/paginated.dto.d.ts +8 -0
- package/dist/dtos/paginated.dto.js +51 -0
- package/dist/dtos/paginated.dto.js.map +1 -0
- package/dist/dtos/project-config.dto.d.ts +5 -0
- package/dist/dtos/project-config.dto.js +45 -0
- package/dist/dtos/project-config.dto.js.map +1 -0
- package/dist/dtos/project-context.dto.d.ts +2 -0
- package/dist/dtos/project-context.dto.js +7 -0
- package/dist/dtos/project-context.dto.js.map +1 -0
- package/dist/dtos/project-create.dto.d.ts +6 -0
- package/dist/dtos/project-create.dto.js +68 -0
- package/dist/dtos/project-create.dto.js.map +1 -0
- package/dist/dtos/project-filter.dto.d.ts +3 -0
- package/dist/dtos/project-filter.dto.js +25 -0
- package/dist/dtos/project-filter.dto.js.map +1 -0
- package/dist/dtos/project-item.dto.d.ts +13 -0
- package/dist/dtos/project-item.dto.js +110 -0
- package/dist/dtos/project-item.dto.js.map +1 -0
- package/dist/dtos/project-query-dto.d.ts +8 -0
- package/dist/dtos/project-query-dto.js +56 -0
- package/dist/dtos/project-query-dto.js.map +1 -0
- package/dist/dtos/project-sort-by.dto.d.ts +6 -0
- package/dist/dtos/project-sort-by.dto.js +31 -0
- package/dist/dtos/project-sort-by.dto.js.map +1 -0
- package/dist/dtos/project-update.dto.d.ts +4 -0
- package/dist/dtos/project-update.dto.js +47 -0
- package/dist/dtos/project-update.dto.js.map +1 -0
- package/dist/dtos/project.dto.d.ts +16 -0
- package/dist/dtos/project.dto.js +125 -0
- package/dist/dtos/project.dto.js.map +1 -0
- package/dist/dtos/run-project-payload.dto.d.ts +4 -0
- package/dist/dtos/run-project-payload.dto.js +24 -0
- package/dist/dtos/run-project-payload.dto.js.map +1 -0
- package/dist/dtos/user.dto.d.ts +4 -0
- package/dist/dtos/user.dto.js +29 -0
- package/dist/dtos/user.dto.js.map +1 -0
- package/dist/dtos/workflow-filter.dto.d.ts +4 -0
- package/dist/dtos/workflow-filter.dto.js +32 -0
- package/dist/dtos/workflow-filter.dto.js.map +1 -0
- package/dist/dtos/workflow-item.dto.d.ts +19 -0
- package/dist/dtos/workflow-item.dto.js +170 -0
- package/dist/dtos/workflow-item.dto.js.map +1 -0
- package/dist/dtos/workflow-query-dto.d.ts +8 -0
- package/dist/dtos/workflow-query-dto.js +56 -0
- package/dist/dtos/workflow-query-dto.js.map +1 -0
- package/dist/dtos/workflow-sort-by.dto.d.ts +6 -0
- package/dist/dtos/workflow-sort-by.dto.js +31 -0
- package/dist/dtos/workflow-sort-by.dto.js.map +1 -0
- package/dist/dtos/workflow.dto.d.ts +20 -0
- package/dist/dtos/workflow.dto.js +180 -0
- package/dist/dtos/workflow.dto.js.map +1 -0
- package/dist/dtos/workspace-config.dto.d.ts +4 -0
- package/dist/dtos/workspace-config.dto.js +36 -0
- package/dist/dtos/workspace-config.dto.js.map +1 -0
- package/dist/dtos/workspace-create.dto.d.ts +4 -0
- package/dist/dtos/workspace-create.dto.js +38 -0
- package/dist/dtos/workspace-create.dto.js.map +1 -0
- package/dist/dtos/workspace-filter.dto.d.ts +2 -0
- package/dist/dtos/workspace-filter.dto.js +7 -0
- package/dist/dtos/workspace-filter.dto.js.map +1 -0
- package/dist/dtos/workspace-item.dto.d.ts +9 -0
- package/dist/dtos/workspace-item.dto.js +70 -0
- package/dist/dtos/workspace-item.dto.js.map +1 -0
- package/dist/dtos/workspace-query-dto.d.ts +8 -0
- package/dist/dtos/workspace-query-dto.js +56 -0
- package/dist/dtos/workspace-query-dto.js.map +1 -0
- package/dist/dtos/workspace-sort-by.dto.d.ts +6 -0
- package/dist/dtos/workspace-sort-by.dto.js +31 -0
- package/dist/dtos/workspace-sort-by.dto.js.map +1 -0
- package/dist/dtos/workspace-update.dto.d.ts +3 -0
- package/dist/dtos/workspace-update.dto.js +29 -0
- package/dist/dtos/workspace-update.dto.js.map +1 -0
- package/dist/dtos/workspace.dto.d.ts +10 -0
- package/dist/dtos/workspace.dto.js +79 -0
- package/dist/dtos/workspace.dto.js.map +1 -0
- package/dist/enums/sort-order.enum.d.ts +4 -0
- package/dist/enums/sort-order.enum.js +9 -0
- package/dist/enums/sort-order.enum.js.map +1 -0
- package/dist/guards/dev-auth.guard.d.ts +8 -0
- package/dist/guards/dev-auth.guard.js +34 -0
- package/dist/guards/dev-auth.guard.js.map +1 -0
- package/dist/guards/jwt-auth.guard.d.ts +4 -0
- package/dist/guards/jwt-auth.guard.js +18 -0
- package/dist/guards/jwt-auth.guard.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/api-config-options.d.ts +11 -0
- package/dist/interfaces/api-config-options.js +3 -0
- package/dist/interfaces/api-config-options.js.map +1 -0
- package/dist/interfaces/api-request.type.d.ts +6 -0
- package/dist/interfaces/api-request.type.js +3 -0
- package/dist/interfaces/api-request.type.js.map +1 -0
- package/dist/interfaces/module-options.interface.d.ts +2 -0
- package/dist/interfaces/module-options.interface.js +3 -0
- package/dist/interfaces/module-options.interface.js.map +1 -0
- package/dist/loop-api.module-definition.d.ts +2 -0
- package/dist/loop-api.module-definition.js +7 -0
- package/dist/loop-api.module-definition.js.map +1 -0
- package/dist/loopstack-api.module.d.ts +6 -0
- package/dist/loopstack-api.module.js +119 -0
- package/dist/loopstack-api.module.js.map +1 -0
- package/dist/services/auth.service.d.ts +9 -0
- package/dist/services/auth.service.js +37 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/document-api.service.d.ts +20 -0
- package/dist/services/document-api.service.js +73 -0
- package/dist/services/document-api.service.js.map +1 -0
- package/dist/services/namespace-api.service.d.ts +20 -0
- package/dist/services/namespace-api.service.js +74 -0
- package/dist/services/namespace-api.service.js.map +1 -0
- package/dist/services/processor-api.service.d.ts +13 -0
- package/dist/services/processor-api.service.js +65 -0
- package/dist/services/processor-api.service.js.map +1 -0
- package/dist/services/project-api.service.d.ts +36 -0
- package/dist/services/project-api.service.js +187 -0
- package/dist/services/project-api.service.js.map +1 -0
- package/dist/services/workflow-api.service.d.ts +21 -0
- package/dist/services/workflow-api.service.js +84 -0
- package/dist/services/workflow-api.service.js.map +1 -0
- package/dist/services/workspace-api.service.d.ts +35 -0
- package/dist/services/workspace-api.service.js +173 -0
- package/dist/services/workspace-api.service.js.map +1 -0
- package/dist/services/ws-event-emitter.service.d.ts +12 -0
- package/dist/services/ws-event-emitter.service.js +65 -0
- package/dist/services/ws-event-emitter.service.js.map +1 -0
- package/dist/strategies/jwt.strategy.d.ts +8 -0
- package/dist/strategies/jwt.strategy.js +39 -0
- package/dist/strategies/jwt.strategy.js.map +1 -0
- package/dist/strategies/null.strategy.d.ts +10 -0
- package/dist/strategies/null.strategy.js +30 -0
- package/dist/strategies/null.strategy.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/get-entity-columns.util.d.ts +1 -0
- package/dist/utils/get-entity-columns.util.js +11 -0
- package/dist/utils/get-entity-columns.util.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ProjectController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const project_api_service_1 = require("../services/project-api.service");
|
|
19
|
+
const project_update_dto_1 = require("../dtos/project-update.dto");
|
|
20
|
+
const project_create_dto_1 = require("../dtos/project-create.dto");
|
|
21
|
+
const paginated_dto_1 = require("../dtos/paginated.dto");
|
|
22
|
+
const api_paginated_response_decorator_1 = require("../decorators/api-paginated-response.decorator");
|
|
23
|
+
const project_dto_1 = require("../dtos/project.dto");
|
|
24
|
+
const project_item_dto_1 = require("../dtos/project-item.dto");
|
|
25
|
+
const project_sort_by_dto_1 = require("../dtos/project-sort-by.dto");
|
|
26
|
+
const project_filter_dto_1 = require("../dtos/project-filter.dto");
|
|
27
|
+
const jwt_auth_guard_1 = require("../guards/jwt-auth.guard");
|
|
28
|
+
let ProjectController = class ProjectController {
|
|
29
|
+
projectService;
|
|
30
|
+
constructor(projectService) {
|
|
31
|
+
this.projectService = projectService;
|
|
32
|
+
}
|
|
33
|
+
async getProjects(req, page, limit, filterParam, sortByParam, search, searchColumnsParam) {
|
|
34
|
+
let filter = {};
|
|
35
|
+
if (filterParam) {
|
|
36
|
+
try {
|
|
37
|
+
filter = JSON.parse(filterParam);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new common_1.BadRequestException('Invalid filter format');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let sortBy = [];
|
|
44
|
+
if (sortByParam) {
|
|
45
|
+
try {
|
|
46
|
+
sortBy = JSON.parse(sortByParam);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new common_1.BadRequestException('Invalid sortBy format');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let searchColumns = [];
|
|
53
|
+
if (searchColumnsParam) {
|
|
54
|
+
try {
|
|
55
|
+
searchColumns = JSON.parse(searchColumnsParam);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new common_1.BadRequestException('Invalid searchColumns format');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const result = await this.projectService.findAll(req.user.id, filter, sortBy, {
|
|
62
|
+
page,
|
|
63
|
+
limit,
|
|
64
|
+
}, {
|
|
65
|
+
query: search,
|
|
66
|
+
columns: searchColumns,
|
|
67
|
+
});
|
|
68
|
+
return paginated_dto_1.PaginatedDto.create(project_item_dto_1.ProjectItemDto, result);
|
|
69
|
+
}
|
|
70
|
+
async getProjectById(id, req) {
|
|
71
|
+
const project = await this.projectService.findOneById(id, req.user.id);
|
|
72
|
+
return project_dto_1.ProjectDto.create(project);
|
|
73
|
+
}
|
|
74
|
+
async createProject(projectData, req) {
|
|
75
|
+
const project = await this.projectService.create(projectData, req.user.id);
|
|
76
|
+
return project_dto_1.ProjectDto.create(project);
|
|
77
|
+
}
|
|
78
|
+
async updateProject(id, projectData, req) {
|
|
79
|
+
const project = await this.projectService.update(id, projectData, req.user.id);
|
|
80
|
+
return project_dto_1.ProjectDto.create(project);
|
|
81
|
+
}
|
|
82
|
+
async deleteProject(id, req) {
|
|
83
|
+
await this.projectService.delete(id, req.user.id);
|
|
84
|
+
}
|
|
85
|
+
async batchDeleteProjects(batchDeleteDto, req) {
|
|
86
|
+
return await this.projectService.batchDelete(batchDeleteDto.ids, req.user.id);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.ProjectController = ProjectController;
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, common_1.Get)(),
|
|
92
|
+
(0, swagger_1.ApiOperation)({
|
|
93
|
+
summary: 'Retrieve projects with filters, sorting, pagination, and search',
|
|
94
|
+
}),
|
|
95
|
+
(0, swagger_1.ApiExtraModels)(project_filter_dto_1.ProjectFilterDto, project_sort_by_dto_1.ProjectSortByDto),
|
|
96
|
+
(0, swagger_1.ApiQuery)({
|
|
97
|
+
name: 'page',
|
|
98
|
+
required: false,
|
|
99
|
+
type: Number,
|
|
100
|
+
description: 'Page number for pagination (starts at 1)',
|
|
101
|
+
}),
|
|
102
|
+
(0, swagger_1.ApiQuery)({
|
|
103
|
+
name: 'limit',
|
|
104
|
+
required: false,
|
|
105
|
+
type: Number,
|
|
106
|
+
description: 'Number of items per page',
|
|
107
|
+
}),
|
|
108
|
+
(0, swagger_1.ApiQuery)({
|
|
109
|
+
name: 'sortBy',
|
|
110
|
+
required: false,
|
|
111
|
+
schema: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
example: '[{"field":"createdAt","order":"DESC"}]',
|
|
114
|
+
},
|
|
115
|
+
description: 'JSON string array of ProjectSortByDto objects',
|
|
116
|
+
}),
|
|
117
|
+
(0, swagger_1.ApiQuery)({
|
|
118
|
+
name: 'filter',
|
|
119
|
+
required: false,
|
|
120
|
+
schema: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
example: '{"workspaceId":"123e4567-e89b-12d3-a456-426614174000"}',
|
|
123
|
+
},
|
|
124
|
+
description: 'JSON string of ProjectFilterDto object',
|
|
125
|
+
}),
|
|
126
|
+
(0, swagger_1.ApiQuery)({
|
|
127
|
+
name: 'search',
|
|
128
|
+
required: false,
|
|
129
|
+
type: String,
|
|
130
|
+
description: 'Search term to filter workspaces by title or other searchable fields',
|
|
131
|
+
}),
|
|
132
|
+
(0, swagger_1.ApiQuery)({
|
|
133
|
+
name: 'searchColumns',
|
|
134
|
+
required: false,
|
|
135
|
+
schema: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
example: '["title","description"]',
|
|
138
|
+
},
|
|
139
|
+
description: 'JSON string array of columns to search in (defaults to title and type if not specified)',
|
|
140
|
+
}),
|
|
141
|
+
(0, api_paginated_response_decorator_1.ApiPaginatedResponse)(project_item_dto_1.ProjectItemDto),
|
|
142
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
143
|
+
__param(0, (0, common_1.Request)()),
|
|
144
|
+
__param(1, (0, common_1.Query)('page', new common_1.ParseIntPipe({ optional: true }))),
|
|
145
|
+
__param(2, (0, common_1.Query)('limit', new common_1.ParseIntPipe({ optional: true }))),
|
|
146
|
+
__param(3, (0, common_1.Query)('filter')),
|
|
147
|
+
__param(4, (0, common_1.Query)('sortBy')),
|
|
148
|
+
__param(5, (0, common_1.Query)('search')),
|
|
149
|
+
__param(6, (0, common_1.Query)('searchColumns')),
|
|
150
|
+
__metadata("design:type", Function),
|
|
151
|
+
__metadata("design:paramtypes", [Object, Number, Number, String, String, String, String]),
|
|
152
|
+
__metadata("design:returntype", Promise)
|
|
153
|
+
], ProjectController.prototype, "getProjects", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, common_1.Get)(':id'),
|
|
156
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get a project by ID' }),
|
|
157
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, description: 'The ID of the project' }),
|
|
158
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'Project not found' }),
|
|
159
|
+
(0, swagger_1.ApiOkResponse)({ type: project_dto_1.ProjectDto }),
|
|
160
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
161
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
162
|
+
__param(0, (0, common_1.Param)('id')),
|
|
163
|
+
__param(1, (0, common_1.Request)()),
|
|
164
|
+
__metadata("design:type", Function),
|
|
165
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
166
|
+
__metadata("design:returntype", Promise)
|
|
167
|
+
], ProjectController.prototype, "getProjectById", null);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, common_1.Post)(),
|
|
170
|
+
(0, swagger_1.ApiOperation)({ summary: 'Create a new project' }),
|
|
171
|
+
(0, swagger_1.ApiBody)({ type: project_create_dto_1.ProjectCreateDto, description: 'Project data' }),
|
|
172
|
+
(0, swagger_1.ApiOkResponse)({ type: project_dto_1.ProjectDto }),
|
|
173
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
174
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
175
|
+
__param(0, (0, common_1.Body)()),
|
|
176
|
+
__param(1, (0, common_1.Request)()),
|
|
177
|
+
__metadata("design:type", Function),
|
|
178
|
+
__metadata("design:paramtypes", [project_create_dto_1.ProjectCreateDto, Object]),
|
|
179
|
+
__metadata("design:returntype", Promise)
|
|
180
|
+
], ProjectController.prototype, "createProject", null);
|
|
181
|
+
__decorate([
|
|
182
|
+
(0, common_1.Put)(':id'),
|
|
183
|
+
(0, swagger_1.ApiOperation)({ summary: 'Update a project by ID' }),
|
|
184
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, description: 'The ID of the project' }),
|
|
185
|
+
(0, swagger_1.ApiBody)({ type: project_update_dto_1.ProjectUpdateDto, description: 'Updated project data' }),
|
|
186
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'Project not found' }),
|
|
187
|
+
(0, swagger_1.ApiOkResponse)({ type: project_dto_1.ProjectDto }),
|
|
188
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
189
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
190
|
+
__param(0, (0, common_1.Param)('id')),
|
|
191
|
+
__param(1, (0, common_1.Body)()),
|
|
192
|
+
__param(2, (0, common_1.Request)()),
|
|
193
|
+
__metadata("design:type", Function),
|
|
194
|
+
__metadata("design:paramtypes", [String, project_update_dto_1.ProjectUpdateDto, Object]),
|
|
195
|
+
__metadata("design:returntype", Promise)
|
|
196
|
+
], ProjectController.prototype, "updateProject", null);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, common_1.Delete)('id/:id'),
|
|
199
|
+
(0, swagger_1.ApiOperation)({ summary: 'Delete a project by ID' }),
|
|
200
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, description: 'The ID of the project' }),
|
|
201
|
+
(0, swagger_1.ApiResponse)({ status: 204, description: 'Project deleted successfully' }),
|
|
202
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'Project not found' }),
|
|
203
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
204
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
205
|
+
__param(0, (0, common_1.Param)('id')),
|
|
206
|
+
__param(1, (0, common_1.Request)()),
|
|
207
|
+
__metadata("design:type", Function),
|
|
208
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
209
|
+
__metadata("design:returntype", Promise)
|
|
210
|
+
], ProjectController.prototype, "deleteProject", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, common_1.Delete)('batch'),
|
|
213
|
+
(0, swagger_1.ApiOperation)({ summary: 'Delete multiple projects by IDs' }),
|
|
214
|
+
(0, swagger_1.ApiBody)({
|
|
215
|
+
description: 'Array of project IDs to delete',
|
|
216
|
+
schema: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
ids: {
|
|
220
|
+
type: 'array',
|
|
221
|
+
items: {
|
|
222
|
+
type: 'string'
|
|
223
|
+
},
|
|
224
|
+
description: 'Array of project IDs to delete',
|
|
225
|
+
example: ['project-1', 'project-2', 'project-3']
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
required: ['ids']
|
|
229
|
+
}
|
|
230
|
+
}),
|
|
231
|
+
(0, swagger_1.ApiResponse)({
|
|
232
|
+
status: 200,
|
|
233
|
+
description: 'Batch delete completed',
|
|
234
|
+
schema: {
|
|
235
|
+
type: 'object',
|
|
236
|
+
properties: {
|
|
237
|
+
deleted: {
|
|
238
|
+
type: 'array',
|
|
239
|
+
items: { type: 'string' },
|
|
240
|
+
description: 'Successfully deleted project IDs'
|
|
241
|
+
},
|
|
242
|
+
failed: {
|
|
243
|
+
type: 'array',
|
|
244
|
+
items: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
properties: {
|
|
247
|
+
id: { type: 'string' },
|
|
248
|
+
error: { type: 'string' }
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
description: 'Failed deletions with error details'
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}),
|
|
256
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: 'Invalid request body' }),
|
|
257
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
258
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
259
|
+
__param(0, (0, common_1.Body)()),
|
|
260
|
+
__param(1, (0, common_1.Request)()),
|
|
261
|
+
__metadata("design:type", Function),
|
|
262
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
263
|
+
__metadata("design:returntype", Promise)
|
|
264
|
+
], ProjectController.prototype, "batchDeleteProjects", null);
|
|
265
|
+
exports.ProjectController = ProjectController = __decorate([
|
|
266
|
+
(0, swagger_1.ApiTags)('api/v1/projects'),
|
|
267
|
+
(0, swagger_1.ApiExtraModels)(project_dto_1.ProjectDto, project_item_dto_1.ProjectItemDto, project_create_dto_1.ProjectCreateDto, project_update_dto_1.ProjectUpdateDto),
|
|
268
|
+
(0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true, whitelist: true })),
|
|
269
|
+
(0, common_1.Controller)('api/v1/projects'),
|
|
270
|
+
__metadata("design:paramtypes", [project_api_service_1.ProjectApiService])
|
|
271
|
+
], ProjectController);
|
|
272
|
+
//# sourceMappingURL=project.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.controller.js","sourceRoot":"","sources":["../../src/controllers/project.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAcwB;AACxB,6CASyB;AAEzB,yEAAoE;AACpE,mEAA8D;AAC9D,mEAA8D;AAC9D,yDAAqD;AACrD,qGAAsF;AACtF,qDAAiD;AACjD,+DAA0D;AAC1D,qEAA+D;AAC/D,mEAA8D;AAC9D,6DAAwD;AAOjD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACC;IAA7B,YAA6B,cAAiC;QAAjC,mBAAc,GAAd,cAAc,CAAmB;IAAG,CAAC;IAyD5D,AAAN,KAAK,CAAC,WAAW,CACJ,GAAQ,EACkC,IAAa,EACZ,KAAc,EACnD,WAAoB,EACpB,WAAoB,EACpB,MAAe,EACR,kBAA2B;QAEnD,IAAI,MAAM,GAAqB,EAAE,CAAC;QAClC,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAqB,CAAC;YACvD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,4BAAmB,CAAC,uBAAuB,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAED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
import { ApiRequestType } from '../interfaces/api-request.type';
|
|
2
|
+
import { WorkflowApiService } from '../services/workflow-api.service';
|
|
3
|
+
import { PaginatedDto } from '../dtos/paginated.dto';
|
|
4
|
+
import { WorkflowDto } from '../dtos/workflow.dto';
|
|
5
|
+
import { WorkflowItemDto } from '../dtos/workflow-item.dto';
|
|
6
|
+
export declare class WorkflowController {
|
|
7
|
+
private readonly workflowService;
|
|
8
|
+
constructor(workflowService: WorkflowApiService);
|
|
9
|
+
getWorkflows(req: any, page?: number, limit?: number, filterParam?: string, sortByParam?: string): Promise<PaginatedDto<WorkflowItemDto>>;
|
|
10
|
+
getWorkflowById(id: string, req: ApiRequestType): Promise<WorkflowDto>;
|
|
11
|
+
deleteWorkflow(id: string, req: ApiRequestType): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WorkflowController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const workflow_api_service_1 = require("../services/workflow-api.service");
|
|
19
|
+
const paginated_dto_1 = require("../dtos/paginated.dto");
|
|
20
|
+
const api_paginated_response_decorator_1 = require("../decorators/api-paginated-response.decorator");
|
|
21
|
+
const workflow_dto_1 = require("../dtos/workflow.dto");
|
|
22
|
+
const workflow_item_dto_1 = require("../dtos/workflow-item.dto");
|
|
23
|
+
const workflow_filter_dto_1 = require("../dtos/workflow-filter.dto");
|
|
24
|
+
const workflow_sort_by_dto_1 = require("../dtos/workflow-sort-by.dto");
|
|
25
|
+
const jwt_auth_guard_1 = require("../guards/jwt-auth.guard");
|
|
26
|
+
let WorkflowController = class WorkflowController {
|
|
27
|
+
workflowService;
|
|
28
|
+
constructor(workflowService) {
|
|
29
|
+
this.workflowService = workflowService;
|
|
30
|
+
}
|
|
31
|
+
async getWorkflows(req, page, limit, filterParam, sortByParam) {
|
|
32
|
+
let filter = {};
|
|
33
|
+
if (filterParam) {
|
|
34
|
+
try {
|
|
35
|
+
filter = JSON.parse(filterParam);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
throw new common_1.BadRequestException('Invalid filter format');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
let sortBy = [];
|
|
42
|
+
if (sortByParam) {
|
|
43
|
+
try {
|
|
44
|
+
sortBy = JSON.parse(sortByParam);
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
throw new common_1.BadRequestException('Invalid sortBy format');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const result = await this.workflowService.findAll(req.user.id, filter, sortBy, {
|
|
51
|
+
page,
|
|
52
|
+
limit,
|
|
53
|
+
});
|
|
54
|
+
return paginated_dto_1.PaginatedDto.create(workflow_item_dto_1.WorkflowItemDto, result);
|
|
55
|
+
}
|
|
56
|
+
async getWorkflowById(id, req) {
|
|
57
|
+
const workflow = await this.workflowService.findOneById(id, req.user.id);
|
|
58
|
+
return workflow_dto_1.WorkflowDto.create(workflow);
|
|
59
|
+
}
|
|
60
|
+
async deleteWorkflow(id, req) {
|
|
61
|
+
await this.workflowService.delete(id, req.user.id);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.WorkflowController = WorkflowController;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, common_1.Get)(),
|
|
67
|
+
(0, swagger_1.ApiOperation)({
|
|
68
|
+
summary: 'Retrieve workflows with filters, sorting, and pagination',
|
|
69
|
+
}),
|
|
70
|
+
(0, swagger_1.ApiExtraModels)(workflow_filter_dto_1.WorkflowFilterDto, workflow_sort_by_dto_1.WorkflowSortByDto),
|
|
71
|
+
(0, swagger_1.ApiQuery)({
|
|
72
|
+
name: 'page',
|
|
73
|
+
required: false,
|
|
74
|
+
type: Number,
|
|
75
|
+
description: 'Page number for pagination (starts at 1)',
|
|
76
|
+
}),
|
|
77
|
+
(0, swagger_1.ApiQuery)({
|
|
78
|
+
name: 'limit',
|
|
79
|
+
required: false,
|
|
80
|
+
type: Number,
|
|
81
|
+
description: 'Number of items per page',
|
|
82
|
+
}),
|
|
83
|
+
(0, swagger_1.ApiQuery)({
|
|
84
|
+
name: 'sortBy',
|
|
85
|
+
required: false,
|
|
86
|
+
schema: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
example: '[{"field":"createdAt","order":"DESC"}]',
|
|
89
|
+
},
|
|
90
|
+
description: 'JSON string array of WorkflowSortByDto objects',
|
|
91
|
+
}),
|
|
92
|
+
(0, swagger_1.ApiQuery)({
|
|
93
|
+
name: 'filter',
|
|
94
|
+
required: false,
|
|
95
|
+
schema: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
example: '{"projectId":"123e4567-e89b-12d3-a456-426614174000"}',
|
|
98
|
+
},
|
|
99
|
+
description: 'JSON string of WorkflowFilterDto object',
|
|
100
|
+
}),
|
|
101
|
+
(0, api_paginated_response_decorator_1.ApiPaginatedResponse)(workflow_item_dto_1.WorkflowItemDto),
|
|
102
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
103
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
104
|
+
__param(0, (0, common_1.Request)()),
|
|
105
|
+
__param(1, (0, common_1.Query)('page', new common_1.ParseIntPipe({ optional: true }))),
|
|
106
|
+
__param(2, (0, common_1.Query)('limit', new common_1.ParseIntPipe({ optional: true }))),
|
|
107
|
+
__param(3, (0, common_1.Query)('filter')),
|
|
108
|
+
__param(4, (0, common_1.Query)('sortBy')),
|
|
109
|
+
__metadata("design:type", Function),
|
|
110
|
+
__metadata("design:paramtypes", [Object, Number, Number, String, String]),
|
|
111
|
+
__metadata("design:returntype", Promise)
|
|
112
|
+
], WorkflowController.prototype, "getWorkflows", null);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, common_1.Get)(':id'),
|
|
115
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get a workflow by ID' }),
|
|
116
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, description: 'The ID of the workflow' }),
|
|
117
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'Workflow not found' }),
|
|
118
|
+
(0, swagger_1.ApiOkResponse)({ type: workflow_dto_1.WorkflowDto }),
|
|
119
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
120
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
121
|
+
__param(0, (0, common_1.Param)('id')),
|
|
122
|
+
__param(1, (0, common_1.Request)()),
|
|
123
|
+
__metadata("design:type", Function),
|
|
124
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
125
|
+
__metadata("design:returntype", Promise)
|
|
126
|
+
], WorkflowController.prototype, "getWorkflowById", null);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, common_1.Delete)(':id'),
|
|
129
|
+
(0, swagger_1.ApiOperation)({ summary: 'Delete a workflow by ID' }),
|
|
130
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, description: 'The ID of the workflow' }),
|
|
131
|
+
(0, swagger_1.ApiResponse)({ status: 204, description: 'Workflow deleted successfully' }),
|
|
132
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'Workflow not found' }),
|
|
133
|
+
(0, swagger_1.ApiUnauthorizedResponse)(),
|
|
134
|
+
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
135
|
+
__param(0, (0, common_1.Param)('id')),
|
|
136
|
+
__param(1, (0, common_1.Request)()),
|
|
137
|
+
__metadata("design:type", Function),
|
|
138
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
139
|
+
__metadata("design:returntype", Promise)
|
|
140
|
+
], WorkflowController.prototype, "deleteWorkflow", null);
|
|
141
|
+
exports.WorkflowController = WorkflowController = __decorate([
|
|
142
|
+
(0, swagger_1.ApiTags)('api/v1/workflows'),
|
|
143
|
+
(0, swagger_1.ApiExtraModels)(workflow_dto_1.WorkflowDto, workflow_item_dto_1.WorkflowItemDto),
|
|
144
|
+
(0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true, whitelist: true })),
|
|
145
|
+
(0, common_1.Controller)('api/v1/workflows'),
|
|
146
|
+
__metadata("design:paramtypes", [workflow_api_service_1.WorkflowApiService])
|
|
147
|
+
], WorkflowController);
|
|
148
|
+
//# sourceMappingURL=workflow.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.controller.js","sourceRoot":"","sources":["../../src/controllers/workflow.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,6CAQyB;AAEzB,2EAAsE;AACtE,yDAAqD;AACrD,qGAAsF;AACtF,uDAAmD;AACnD,iEAA4D;AAC5D,qEAAgE;AAChE,uEAAiE;AACjE,6DAAwD;AAMjD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACA;IAA7B,YAA6B,eAAmC;QAAnC,oBAAe,GAAf,eAAe,CAAoB;IAAG,CAAC;IA2C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,kBAAkB,CAAC;IAC3B,IAAA,wBAAc,EAAC,0BAAW,EAAE,mCAAe,CAAC;IAC5C,IAAA,iBAAQ,EAAC,IAAI,uBAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,IAAA,mBAAU,EAAC,kBAAkB,CAAC;qCAEiB,yCAAkB;GADrD,kBAAkB,CA8G9B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiRequestType } from '../interfaces/api-request.type';
|
|
2
|
+
import { WorkspaceApiService } from '../services/workspace-api.service';
|
|
3
|
+
import { WorkspaceUpdateDto } from '../dtos/workspace-update.dto';
|
|
4
|
+
import { WorkspaceCreateDto } from '../dtos/workspace-create.dto';
|
|
5
|
+
import { PaginatedDto } from '../dtos/paginated.dto';
|
|
6
|
+
import { WorkspaceDto } from '../dtos/workspace.dto';
|
|
7
|
+
import { WorkspaceItemDto } from '../dtos/workspace-item.dto';
|
|
8
|
+
export declare class WorkspaceController {
|
|
9
|
+
private readonly workspaceService;
|
|
10
|
+
constructor(workspaceService: WorkspaceApiService);
|
|
11
|
+
getWorkspaces(req: any, page?: number, limit?: number, filterParam?: string, sortByParam?: string, search?: string, searchColumnsParam?: string): Promise<PaginatedDto<WorkspaceItemDto>>;
|
|
12
|
+
getWorkspaceById(id: string, req: ApiRequestType): Promise<WorkspaceDto>;
|
|
13
|
+
createWorkspace(workspaceData: WorkspaceCreateDto, req: ApiRequestType): Promise<WorkspaceDto>;
|
|
14
|
+
updateWorkspace(id: string, workspaceData: WorkspaceUpdateDto, req: ApiRequestType): Promise<WorkspaceDto>;
|
|
15
|
+
deleteWorkspace(id: string, req: ApiRequestType): Promise<void>;
|
|
16
|
+
batchDeleteWorkspaces(batchDeleteDto: {
|
|
17
|
+
ids: string[];
|
|
18
|
+
}, req: ApiRequestType): Promise<{
|
|
19
|
+
deleted: string[];
|
|
20
|
+
failed: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
error: string;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
}
|