|
@@ -1,4 +1,4 @@
|
|
-import { Controller, Get, Param, Headers } from '@nestjs/common';
|
|
|
|
|
|
+import { Controller, Get, Headers } from '@nestjs/common';
|
|
import { AuthService } from 'src/auth/auth.service';
|
|
import { AuthService } from 'src/auth/auth.service';
|
|
import { DatasourceService } from 'src/datasource/datasource.service';
|
|
import { DatasourceService } from 'src/datasource/datasource.service';
|
|
|
|
|
|
@@ -24,38 +24,6 @@ export class TagController {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- @Get('/get/:id')
|
|
|
|
- async getTagById(@Param('id') id: string) {
|
|
|
|
- const prisma = this.datasource.getPrisma();
|
|
|
|
- const target = await prisma.tag.findUnique({
|
|
|
|
- where: { id: parseInt(id) },
|
|
|
|
- select: {
|
|
|
|
- id: true,
|
|
|
|
- name: true,
|
|
|
|
- color: true,
|
|
|
|
- posts: {
|
|
|
|
- select: {
|
|
|
|
- id: true,
|
|
|
|
- title: true,
|
|
|
|
- createdAt: true,
|
|
|
|
- updatedAt: true,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- if (!target) {
|
|
|
|
- return {
|
|
|
|
- code: 404,
|
|
|
|
- msg: 'Tag not found',
|
|
|
|
- };
|
|
|
|
- } else {
|
|
|
|
- return {
|
|
|
|
- code: 200,
|
|
|
|
- data: target,
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Get('/clear')
|
|
@Get('/clear')
|
|
async clearEmptyTags(@Headers('Authorization') token: string) {
|
|
async clearEmptyTags(@Headers('Authorization') token: string) {
|
|
if (!this.authService.checkBearerToken(token)) {
|
|
if (!this.authService.checkBearerToken(token)) {
|