update first - 84
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
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;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
import { Body, Controller, Get, Inject, Param, ParseIntPipe, Patch, Post, UseGuards, ValidationPipe } from '@nestjs/common';
|
||||
import { ok } from '../common/api-response.js';
|
||||
import { CurrentUser } from '../common/current-user.decorator.js';
|
||||
import { JwtAuthGuard } from '../common/jwt-auth.guard.js';
|
||||
import { RolesGuard } from '../common/roles.guard.js';
|
||||
import { CreateKeyResultDto } from './dto/create-key-result.dto.js';
|
||||
import { UpdateProgressDto } from './dto/update-progress.dto.js';
|
||||
import { KeyResultsService } from './key-results.service.js';
|
||||
let KeyResultsController = class KeyResultsController {
|
||||
keyResultsService;
|
||||
constructor(keyResultsService) {
|
||||
this.keyResultsService = keyResultsService;
|
||||
}
|
||||
async get(id, user) {
|
||||
return ok(await this.keyResultsService.getById(id, user));
|
||||
}
|
||||
async create(dto, user) {
|
||||
return ok(await this.keyResultsService.create(dto, user));
|
||||
}
|
||||
async updateProgress(id, dto, user) {
|
||||
return ok(await this.keyResultsService.updateProgress(id, dto, user));
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
Get(':id'),
|
||||
__param(0, Param('id', ParseIntPipe)),
|
||||
__param(1, CurrentUser()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number, Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], KeyResultsController.prototype, "get", null);
|
||||
__decorate([
|
||||
Post(),
|
||||
__param(0, Body(new ValidationPipe({ expectedType: CreateKeyResultDto, whitelist: true, forbidNonWhitelisted: true, transform: true }))),
|
||||
__param(1, CurrentUser()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [CreateKeyResultDto, Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], KeyResultsController.prototype, "create", null);
|
||||
__decorate([
|
||||
Patch(':id/progress'),
|
||||
__param(0, Param('id', ParseIntPipe)),
|
||||
__param(1, Body(new ValidationPipe({ expectedType: UpdateProgressDto, whitelist: true, forbidNonWhitelisted: true, transform: true }))),
|
||||
__param(2, CurrentUser()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number, UpdateProgressDto, Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], KeyResultsController.prototype, "updateProgress", null);
|
||||
KeyResultsController = __decorate([
|
||||
Controller('key-results'),
|
||||
UseGuards(JwtAuthGuard, RolesGuard),
|
||||
__param(0, Inject(KeyResultsService)),
|
||||
__metadata("design:paramtypes", [KeyResultsService])
|
||||
], KeyResultsController);
|
||||
export { KeyResultsController };
|
||||
Reference in New Issue
Block a user