m
This commit is contained in:
+151
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
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); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SignInController = void 0;
|
||||
const openapi = require("@nestjs/swagger");
|
||||
const common_1 = require("@nestjs/common");
|
||||
const swagger_1 = require("@nestjs/swagger");
|
||||
const api_1 = require("../../common/api");
|
||||
const signin_service_1 = require("../service/signin.service");
|
||||
const user_id_context_1 = require("../../common/context/user_id.context");
|
||||
const signin_dto_1 = require("../dto/signin.dto");
|
||||
const signin_vo_1 = require("../vo/signin.vo");
|
||||
const user_sign_in_calendar_model_1 = require("../../../model/user_sign_in_calendar.model");
|
||||
let SignInController = class SignInController {
|
||||
signInService;
|
||||
constructor(signInService) {
|
||||
this.signInService = signInService;
|
||||
}
|
||||
async info() {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
return await this.signInService.getSignInInfo(userId);
|
||||
}
|
||||
calendar(dto) {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
const now = new Date();
|
||||
const year = dto.year ?? now.getFullYear();
|
||||
const month = dto.month ?? now.getMonth() + 1;
|
||||
return this.signInService.getSignInCalendar(userId, year, month);
|
||||
}
|
||||
progress() {
|
||||
return this.signInService.getProgress();
|
||||
}
|
||||
async taskList() {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
return await this.signInService.getTaskList(userId);
|
||||
}
|
||||
async today() {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
return await this.signInService.todaySignIn(userId);
|
||||
}
|
||||
async makeup(dto) {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
return await this.signInService.makeUpSignIn(userId, dto.date);
|
||||
}
|
||||
async claim(dto) {
|
||||
const userId = (0, user_id_context_1.getUserIdContext)();
|
||||
return await this.signInService.claimReward(userId, dto.rewardId);
|
||||
}
|
||||
};
|
||||
exports.SignInController = SignInController;
|
||||
__decorate([
|
||||
(0, common_1.Get)('info'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取用户签到信息' }),
|
||||
api_1.Api.ApiResponse({
|
||||
codeDescription: '200 成功',
|
||||
model: signin_vo_1.UserSignInVo,
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], SignInController.prototype, "info", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('calendar'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取签到日历(按月查询)' }),
|
||||
api_1.Api.ApiPaginatedResponse({
|
||||
codeDescription: '200 成功',
|
||||
model: user_sign_in_calendar_model_1.UserSignInCalendarModel,
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__param(0, (0, common_1.Query)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [signin_dto_1.SignInCalendarDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], SignInController.prototype, "calendar", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('progress'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取签到进度(7天)' }),
|
||||
api_1.Api.ApiPaginatedResponse({
|
||||
codeDescription: '200 成功',
|
||||
model: signin_vo_1.SignInProgressDayVo,
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], SignInController.prototype, "progress", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('task-list'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取签到任务列表' }),
|
||||
api_1.Api.ApiPaginatedResponse({
|
||||
codeDescription: '200 成功',
|
||||
model: signin_vo_1.SignInTaskVo,
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200, type: Object }),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], SignInController.prototype, "taskList", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('today'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '今日签到' }),
|
||||
api_1.Api.ApiResponse({
|
||||
codeDescription: '200 成功,400 失败',
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], SignInController.prototype, "today", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('makeup'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '补签' }),
|
||||
api_1.Api.ApiResponse({
|
||||
codeDescription: '200 成功,400 失败',
|
||||
}),
|
||||
openapi.ApiResponse({ status: 200 }),
|
||||
__param(0, (0, common_1.Query)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [signin_dto_1.SignInMakeUpDto]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], SignInController.prototype, "makeup", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('claim'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '领取签到奖励' }),
|
||||
api_1.Api.ApiResponse({
|
||||
codeDescription: '200 成功,400 失败',
|
||||
}),
|
||||
openapi.ApiResponse({ status: 201 }),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [signin_dto_1.ClaimRewardDto]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], SignInController.prototype, "claim", null);
|
||||
exports.SignInController = SignInController = __decorate([
|
||||
(0, common_1.Controller)('signin'),
|
||||
(0, swagger_1.ApiTags)('签到管理'),
|
||||
__metadata("design:paramtypes", [signin_service_1.SignInService])
|
||||
], SignInController);
|
||||
//# sourceMappingURL=signin.controller.js.map
|
||||
Reference in New Issue
Block a user