Initial commit after migration to gitea

This commit is contained in:
2026-01-18 11:27:43 +03:30
parent a21039410c
commit ea4b8eb543
196 changed files with 45567 additions and 9 deletions

View File

@@ -0,0 +1,63 @@
import {
Controller,
Get,
Post,
Body,
Patch,
Param,
Delete,
UseGuards,
} from "@nestjs/common";
import { ApiBearerAuth, ApiBody, ApiParam, ApiTags } from "@nestjs/swagger";
import { GlobalGuard } from "src/auth/guards/global.guard";
import { CurrentUser } from "src/decorators/user.decorator";
import { Roles } from "src/decorators/roles.decorator";
import { PlatesService } from "src/plates/plates.service";
import { AddPlateDto, AddPlateProfileDto } from "./dto/user/AddPlateDto";
import { UpdateUserProfileDtoRq } from "./dto/user/update-profile.dto";
import { ProfileService } from "./profile.service";
@Controller("user/profile")
@ApiTags("user")
@ApiBearerAuth()
@Roles()
export class ProfileController {
constructor(
private readonly profileService: ProfileService,
private readonly plateService: PlatesService,
) {}
@Get()
@UseGuards(GlobalGuard)
async getProfile(@CurrentUser() user) {
return await this.profileService.getProfileDetail(user.username);
}
@Patch()
@UseGuards(GlobalGuard)
@ApiBody({ type: UpdateUserProfileDtoRq })
async updateProfile(
@CurrentUser() user,
@Body() body: UpdateUserProfileDtoRq,
) {
return await this.profileService.updateProfile(user.username, body);
}
@Post("plate")
@UseGuards(GlobalGuard)
@ApiBody({ type: AddPlateProfileDto })
async addPlate(@CurrentUser() user, @Body() body: AddPlateDto) {
console.log(
"🚀 ~ file: profile.controller.ts:50 ~ ProfileController ~ addPlate ~ user:",
user,
);
return await this.plateService.addPlate(user.sub, body);
}
@Delete("plate/:id")
@UseGuards(GlobalGuard)
@ApiParam({ name: "id", required: true })
async deletePlate(@Param("id") id) {
return await this.plateService.deletePlate(id);
}
}