diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 01a9998..ba68d75 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -49,6 +49,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . + file: ./apps/api/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index df6603f..eda8f9d 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -3,7 +3,7 @@ name: Update Kubernetes Cluster (Dev) on: push: paths: - - src/** + - apps/api/** - prisma/schema.prisma branches: - main @@ -52,6 +52,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . + file: ./apps/api/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.vscode/settings.json b/.vscode/settings.json index e298df9..91d6cd7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,6 +10,9 @@ "gitops", "gsainfoteam", "infoteam", + "libheif", + "linuxmusl", + "localtime", "LOGGABLE", "metatype", "nestjs", @@ -17,7 +20,8 @@ "openai", "prisma", "rxjs", - "ziggle" + "ziggle", + "zoneinfo" ], "git.branchProtection": ["main"] } diff --git a/Dockerfile b/apps/api/Dockerfile similarity index 100% rename from Dockerfile rename to apps/api/Dockerfile diff --git a/src/ai/ai.controller.ts b/apps/api/src/ai/ai.controller.ts similarity index 94% rename from src/ai/ai.controller.ts rename to apps/api/src/ai/ai.controller.ts index 65d1bd1..47a2c07 100644 --- a/src/ai/ai.controller.ts +++ b/apps/api/src/ai/ai.controller.ts @@ -14,9 +14,9 @@ import { ApiOperation, ApiTags, } from '@nestjs/swagger'; -import { IdPGuard } from 'src/user/guard/idp.guard'; import { TranslateDto } from './dto/req/translate.dto'; import { TranslateResDto } from './dto/res/translateRes.dto'; +import { IdPGuard } from '../user/guard/idp.guard'; @ApiTags('ai') @ApiOAuth2(['email', 'profile', 'openid'], 'oauth2') diff --git a/src/ai/ai.module.ts b/apps/api/src/ai/ai.module.ts similarity index 88% rename from src/ai/ai.module.ts rename to apps/api/src/ai/ai.module.ts index 00e1f33..2de8446 100644 --- a/src/ai/ai.module.ts +++ b/apps/api/src/ai/ai.module.ts @@ -1,9 +1,9 @@ import { Module } from '@nestjs/common'; import { AiService } from './ai.service'; import { AiController } from './ai.controller'; -import { UserModule } from 'src/user/user.module'; import { LoggerModule } from '@lib/logger'; import { CustomConfigModule } from '@lib/custom-config'; +import { UserModule } from '../user/user.module'; @Module({ imports: [CustomConfigModule, UserModule, LoggerModule], diff --git a/src/ai/ai.service.ts b/apps/api/src/ai/ai.service.ts similarity index 100% rename from src/ai/ai.service.ts rename to apps/api/src/ai/ai.service.ts diff --git a/src/ai/dto/req/translate.dto.ts b/apps/api/src/ai/dto/req/translate.dto.ts similarity index 100% rename from src/ai/dto/req/translate.dto.ts rename to apps/api/src/ai/dto/req/translate.dto.ts diff --git a/src/ai/dto/res/translateRes.dto.ts b/apps/api/src/ai/dto/res/translateRes.dto.ts similarity index 100% rename from src/ai/dto/res/translateRes.dto.ts rename to apps/api/src/ai/dto/res/translateRes.dto.ts diff --git a/src/ai/types/deadlineResponse.type.ts b/apps/api/src/ai/types/deadlineResponse.type.ts similarity index 100% rename from src/ai/types/deadlineResponse.type.ts rename to apps/api/src/ai/types/deadlineResponse.type.ts diff --git a/src/app.controller.ts b/apps/api/src/api.controller.ts similarity index 93% rename from src/app.controller.ts rename to apps/api/src/api.controller.ts index fb83874..45b9206 100644 --- a/src/app.controller.ts +++ b/apps/api/src/api.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common'; import { ApiResponse } from '@nestjs/swagger'; @Controller() -export class AppController { +export class ApiController { @ApiResponse({ status: 200, description: 'Send the message "pong" when the server is active.', diff --git a/src/app.module.ts b/apps/api/src/api.module.ts similarity index 94% rename from src/app.module.ts rename to apps/api/src/api.module.ts index d3f114f..b7beb32 100644 --- a/src/app.module.ts +++ b/apps/api/src/api.module.ts @@ -1,5 +1,4 @@ import { Module } from '@nestjs/common'; -import { AppController } from './app.controller'; import { FileModule } from './file/file.module'; import { UserModule } from './user/user.module'; import { TagModule } from './tag/tag.module'; @@ -14,6 +13,7 @@ import { AiModule } from './ai/ai.module'; import { CustomConfigModule, CustomConfigService } from '@lib/custom-config'; import { HealthModule } from './health/health.module'; import { RedisModule } from '@nestjs-modules/ioredis'; +import { ApiController } from './api.controller'; @Module({ imports: [ @@ -51,6 +51,6 @@ import { RedisModule } from '@nestjs-modules/ioredis'; AiModule, HealthModule, ], - controllers: [AppController], + controllers: [ApiController], }) -export class AppModule {} +export class ApiModule {} diff --git a/src/crawl/crawl.controller.ts b/apps/api/src/crawl/crawl.controller.ts similarity index 100% rename from src/crawl/crawl.controller.ts rename to apps/api/src/crawl/crawl.controller.ts diff --git a/src/crawl/crawl.module.ts b/apps/api/src/crawl/crawl.module.ts similarity index 80% rename from src/crawl/crawl.module.ts rename to apps/api/src/crawl/crawl.module.ts index 39a51ae..0cc5956 100644 --- a/src/crawl/crawl.module.ts +++ b/apps/api/src/crawl/crawl.module.ts @@ -2,12 +2,12 @@ import { Module } from '@nestjs/common'; import { CrawlService } from './crawl.service'; import { CrawlController } from './crawl.controller'; import { CrawlRepository } from './crawl.repository'; -import { UserModule } from 'src/user/user.module'; -import { AiModule } from 'src/ai/ai.module'; -import { FcmModule } from 'src/fcm/fcm.module'; import { PrismaModule } from '@lib/prisma'; import { LoggerModule } from '@lib/logger'; import { CustomConfigModule } from '@lib/custom-config'; +import { UserModule } from '../user/user.module'; +import { AiModule } from '../ai/ai.module'; +import { FcmModule } from '../fcm/fcm.module'; @Module({ imports: [ diff --git a/src/crawl/crawl.repository.ts b/apps/api/src/crawl/crawl.repository.ts similarity index 100% rename from src/crawl/crawl.repository.ts rename to apps/api/src/crawl/crawl.repository.ts diff --git a/src/crawl/crawl.service.ts b/apps/api/src/crawl/crawl.service.ts similarity index 91% rename from src/crawl/crawl.service.ts rename to apps/api/src/crawl/crawl.service.ts index 509b8db..7af26a2 100644 --- a/src/crawl/crawl.service.ts +++ b/apps/api/src/crawl/crawl.service.ts @@ -6,14 +6,14 @@ import { } from '@nestjs/common'; import { CrawlRepository } from './crawl.repository'; import { CreateCrawlDto } from './dto/req/createCrawl.dto'; -import { UserService } from 'src/user/user.service'; import { Crawl } from '@prisma/client'; import { GetCrawlDto } from './dto/req/getCrawl.dto'; -import { AiService } from 'src/ai/ai.service'; -import { FcmService } from 'src/fcm/fcm.service'; -import { FcmTargetUser } from 'src/fcm/types/fcmTargetUser.type'; import { Loggable } from '@lib/logger/decorator/loggable'; import { CustomConfigService } from '@lib/custom-config'; +import { UserService } from '../user/user.service'; +import { FcmService } from '../fcm/fcm.service'; +import { AiService } from '../ai/ai.service'; +import { FcmTargetUser } from '../fcm/types/fcmTargetUser.type'; @Injectable() @Loggable() diff --git a/src/crawl/dto/req/createCrawl.dto.ts b/apps/api/src/crawl/dto/req/createCrawl.dto.ts similarity index 100% rename from src/crawl/dto/req/createCrawl.dto.ts rename to apps/api/src/crawl/dto/req/createCrawl.dto.ts diff --git a/src/crawl/dto/req/getCrawl.dto.ts b/apps/api/src/crawl/dto/req/getCrawl.dto.ts similarity index 100% rename from src/crawl/dto/req/getCrawl.dto.ts rename to apps/api/src/crawl/dto/req/getCrawl.dto.ts diff --git a/src/document/document.controller.ts b/apps/api/src/document/document.controller.ts similarity index 100% rename from src/document/document.controller.ts rename to apps/api/src/document/document.controller.ts diff --git a/src/document/document.module.ts b/apps/api/src/document/document.module.ts similarity index 88% rename from src/document/document.module.ts rename to apps/api/src/document/document.module.ts index 3bab816..3e85fb1 100644 --- a/src/document/document.module.ts +++ b/apps/api/src/document/document.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { DocumentController } from './document.controller'; import { DocumentService } from './document.service'; -import { FileModule } from 'src/file/file.module'; import { LoggerModule } from '@lib/logger'; +import { FileModule } from '../file/file.module'; @Module({ imports: [FileModule, LoggerModule], diff --git a/src/document/document.service.ts b/apps/api/src/document/document.service.ts similarity index 97% rename from src/document/document.service.ts rename to apps/api/src/document/document.service.ts index 2fce6a1..6108ad0 100644 --- a/src/document/document.service.ts +++ b/apps/api/src/document/document.service.ts @@ -1,7 +1,7 @@ import { Loggable } from '@lib/logger/decorator/loggable'; import { Injectable, Logger } from '@nestjs/common'; import path from 'path'; -import { FileService } from 'src/file/file.service'; +import { FileService } from '../file/file.service'; @Injectable() @Loggable() diff --git a/src/fcm/fcm.consumer.ts b/apps/api/src/fcm/fcm.consumer.ts similarity index 100% rename from src/fcm/fcm.consumer.ts rename to apps/api/src/fcm/fcm.consumer.ts diff --git a/src/fcm/fcm.module.ts b/apps/api/src/fcm/fcm.module.ts similarity index 100% rename from src/fcm/fcm.module.ts rename to apps/api/src/fcm/fcm.module.ts diff --git a/src/fcm/fcm.repository.ts b/apps/api/src/fcm/fcm.repository.ts similarity index 100% rename from src/fcm/fcm.repository.ts rename to apps/api/src/fcm/fcm.repository.ts diff --git a/src/fcm/fcm.service.ts b/apps/api/src/fcm/fcm.service.ts similarity index 100% rename from src/fcm/fcm.service.ts rename to apps/api/src/fcm/fcm.service.ts diff --git a/src/fcm/types/content.type.ts b/apps/api/src/fcm/types/content.type.ts similarity index 100% rename from src/fcm/types/content.type.ts rename to apps/api/src/fcm/types/content.type.ts diff --git a/src/fcm/types/fcmTargetUser.type.ts b/apps/api/src/fcm/types/fcmTargetUser.type.ts similarity index 100% rename from src/fcm/types/fcmTargetUser.type.ts rename to apps/api/src/fcm/types/fcmTargetUser.type.ts diff --git a/src/fcm/types/queue.type.ts b/apps/api/src/fcm/types/queue.type.ts similarity index 100% rename from src/fcm/types/queue.type.ts rename to apps/api/src/fcm/types/queue.type.ts diff --git a/src/file/file.module.ts b/apps/api/src/file/file.module.ts similarity index 100% rename from src/file/file.module.ts rename to apps/api/src/file/file.module.ts diff --git a/src/file/file.service.ts b/apps/api/src/file/file.service.ts similarity index 100% rename from src/file/file.service.ts rename to apps/api/src/file/file.service.ts diff --git a/src/group/dto/req/getGroup.dto.ts b/apps/api/src/group/dto/req/getGroup.dto.ts similarity index 100% rename from src/group/dto/req/getGroup.dto.ts rename to apps/api/src/group/dto/req/getGroup.dto.ts diff --git a/src/group/dto/res/GroupsRes.dto.ts b/apps/api/src/group/dto/res/GroupsRes.dto.ts similarity index 100% rename from src/group/dto/res/GroupsRes.dto.ts rename to apps/api/src/group/dto/res/GroupsRes.dto.ts diff --git a/src/group/dto/res/GroupsTokenRes.dto.ts b/apps/api/src/group/dto/res/GroupsTokenRes.dto.ts similarity index 100% rename from src/group/dto/res/GroupsTokenRes.dto.ts rename to apps/api/src/group/dto/res/GroupsTokenRes.dto.ts diff --git a/src/group/group.controller.ts b/apps/api/src/group/group.controller.ts similarity index 93% rename from src/group/group.controller.ts rename to apps/api/src/group/group.controller.ts index 6a295f7..a2dbd9c 100644 --- a/src/group/group.controller.ts +++ b/apps/api/src/group/group.controller.ts @@ -1,6 +1,5 @@ import { Controller, Get, Post, Query, UseGuards } from '@nestjs/common'; import { GroupService } from './group.service'; -import { IdPGuard } from 'src/user/guard/idp.guard'; import { ApiCreatedResponse, ApiInternalServerErrorResponse, @@ -10,10 +9,11 @@ import { ApiTags, ApiUnauthorizedResponse, } from '@nestjs/swagger'; -import { GetToken } from 'src/user/decorator/get-token.decorator'; import { GroupsTokenRes } from './dto/res/GroupsTokenRes.dto'; import { GroupListResDto } from './dto/res/GroupsRes.dto'; import { GetGroupByNameQueryDto } from './dto/req/getGroup.dto'; +import { IdPGuard } from '../user/guard/idp.guard'; +import { GetToken } from '../user/decorator/get-token.decorator'; @ApiTags('Group') @ApiOAuth2(['email', 'profile', 'openid'], 'oauth2') diff --git a/src/group/group.module.ts b/apps/api/src/group/group.module.ts similarity index 91% rename from src/group/group.module.ts rename to apps/api/src/group/group.module.ts index 47ade99..a2d9adc 100644 --- a/src/group/group.module.ts +++ b/apps/api/src/group/group.module.ts @@ -2,10 +2,10 @@ import { Module } from '@nestjs/common'; import { GroupService } from './group.service'; import { HttpModule } from '@nestjs/axios'; import { GroupController } from './group.controller'; -import { UserModule } from 'src/user/user.module'; import { PrismaModule } from '@lib/prisma'; import { LoggerModule } from '@lib/logger'; import { CustomConfigModule } from '@lib/custom-config'; +import { UserModule } from '../user/user.module'; @Module({ imports: [ diff --git a/src/group/group.service.ts b/apps/api/src/group/group.service.ts similarity index 100% rename from src/group/group.service.ts rename to apps/api/src/group/group.service.ts diff --git a/src/group/types/groupInfo.type.ts b/apps/api/src/group/types/groupInfo.type.ts similarity index 100% rename from src/group/types/groupInfo.type.ts rename to apps/api/src/group/types/groupInfo.type.ts diff --git a/src/group/types/groupsToken.type.ts b/apps/api/src/group/types/groupsToken.type.ts similarity index 100% rename from src/group/types/groupsToken.type.ts rename to apps/api/src/group/types/groupsToken.type.ts diff --git a/src/health/health.controller.ts b/apps/api/src/health/health.controller.ts similarity index 100% rename from src/health/health.controller.ts rename to apps/api/src/health/health.controller.ts diff --git a/src/health/health.module.ts b/apps/api/src/health/health.module.ts similarity index 100% rename from src/health/health.module.ts rename to apps/api/src/health/health.module.ts diff --git a/src/health/indicator/redis.indicator.ts b/apps/api/src/health/indicator/redis.indicator.ts similarity index 100% rename from src/health/indicator/redis.indicator.ts rename to apps/api/src/health/indicator/redis.indicator.ts diff --git a/src/image/image.controller.ts b/apps/api/src/image/image.controller.ts similarity index 100% rename from src/image/image.controller.ts rename to apps/api/src/image/image.controller.ts diff --git a/src/image/image.module.ts b/apps/api/src/image/image.module.ts similarity index 87% rename from src/image/image.module.ts rename to apps/api/src/image/image.module.ts index 2b43a78..22eda7d 100644 --- a/src/image/image.module.ts +++ b/apps/api/src/image/image.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { ImageService } from './image.service'; import { ImageController } from './image.controller'; -import { FileModule } from 'src/file/file.module'; import { LoggerModule } from '@lib/logger'; +import { FileModule } from '../file/file.module'; @Module({ imports: [FileModule, LoggerModule], diff --git a/src/image/image.service.ts b/apps/api/src/image/image.service.ts similarity index 95% rename from src/image/image.service.ts rename to apps/api/src/image/image.service.ts index 9d13bff..e73aa04 100644 --- a/src/image/image.service.ts +++ b/apps/api/src/image/image.service.ts @@ -2,17 +2,15 @@ import { BadRequestException, Injectable, InternalServerErrorException, - Logger, } from '@nestjs/common'; import path from 'path'; -import { FileService } from 'src/file/file.service'; import sharp from 'sharp'; import { Loggable } from '@lib/logger/decorator/loggable'; +import { FileService } from '../file/file.service'; @Injectable() @Loggable() export class ImageService { - private readonly logger = new Logger(ImageService.name); constructor(private readonly fileService: FileService) {} /** diff --git a/src/main.ts b/apps/api/src/main.ts similarity index 96% rename from src/main.ts rename to apps/api/src/main.ts index d190d4c..6126f8c 100644 --- a/src/main.ts +++ b/apps/api/src/main.ts @@ -1,13 +1,13 @@ import { NestFactory } from '@nestjs/core'; -import { AppModule } from './app.module'; import cookieParser from 'cookie-parser'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import expressBasicAuth from 'express-basic-auth'; import { json } from 'express'; import { CustomConfigService } from '@lib/custom-config'; +import { ApiModule } from './api.module'; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(ApiModule); const customConfigService = app.get(CustomConfigService); // swagger auth config app.use( diff --git a/src/notice/dto/req/additionalNotice.dto.ts b/apps/api/src/notice/dto/req/additionalNotice.dto.ts similarity index 95% rename from src/notice/dto/req/additionalNotice.dto.ts rename to apps/api/src/notice/dto/req/additionalNotice.dto.ts index a7c3ba6..efed59d 100644 --- a/src/notice/dto/req/additionalNotice.dto.ts +++ b/apps/api/src/notice/dto/req/additionalNotice.dto.ts @@ -1,50 +1,50 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; -import { - IsDate, - IsEnum, - IsOptional, - IsString, - MaxLength, -} from 'class-validator'; - -export class AdditionalNoticeDto { - @ApiProperty({ - example: '제목', - description: '바뀐 제목 (현재 진짜로 바뀌지는 않음)', - required: false, - }) - @IsString() - @IsOptional() - @MaxLength(200) - title?: string; - - @ApiProperty({ - example: '추가 내용', - description: '추가된 내용', - required: true, - }) - @IsString() - @MaxLength(100000) - body: string; - - @ApiProperty({ - example: '2021-08-01T00:00:00.000Z', - description: '마감일, 가장 최근에 post한 것을 기준으로 설정됨', - required: false, - }) - @Type(() => Date) - @IsDate() - @IsOptional() - deadline?: Date; - - @ApiProperty({ - example: 'all', - description: '공지 알림을 받을 사람들', - required: false, - }) - @IsString() - @IsEnum(['all', 'reminder']) - @IsOptional() - to?: string; -} +import { ApiProperty } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; +import { + IsDate, + IsEnum, + IsOptional, + IsString, + MaxLength, +} from 'class-validator'; + +export class AdditionalNoticeDto { + @ApiProperty({ + example: '제목', + description: '바뀐 제목 (현재 진짜로 바뀌지는 않음)', + required: false, + }) + @IsString() + @IsOptional() + @MaxLength(200) + title?: string; + + @ApiProperty({ + example: '추가 내용', + description: '추가된 내용', + required: true, + }) + @IsString() + @MaxLength(100000) + body: string; + + @ApiProperty({ + example: '2021-08-01T00:00:00.000Z', + description: '마감일, 가장 최근에 post한 것을 기준으로 설정됨', + required: false, + }) + @Type(() => Date) + @IsDate() + @IsOptional() + deadline?: Date; + + @ApiProperty({ + example: 'all', + description: '공지 알림을 받을 사람들', + required: false, + }) + @IsString() + @IsEnum(['all', 'reminder']) + @IsOptional() + to?: string; +} diff --git a/src/notice/dto/req/createNotice.dto.ts b/apps/api/src/notice/dto/req/createNotice.dto.ts similarity index 95% rename from src/notice/dto/req/createNotice.dto.ts rename to apps/api/src/notice/dto/req/createNotice.dto.ts index 145703d..54ab36e 100644 --- a/src/notice/dto/req/createNotice.dto.ts +++ b/apps/api/src/notice/dto/req/createNotice.dto.ts @@ -1,89 +1,89 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { Category } from '@prisma/client'; -import { Type } from 'class-transformer'; -import { - IsDate, - IsEnum, - IsNotEmpty, - IsNumber, - IsOptional, - IsString, - MaxLength, -} from 'class-validator'; - -export class CreateNoticeDto { - @ApiProperty({ - example: '제목', - description: '공지 제목', - required: true, - }) - @IsString() - @IsNotEmpty() - @MaxLength(200) - title: string; - - @ApiProperty({ - example: '
내용<\\p>', - description: '공지 내용', - required: true, - }) - @IsString() - @IsNotEmpty() - @MaxLength(100000) - body: string; - - @ApiPropertyOptional({ - example: '2021-08-01T00:00:00.000Z', - description: '마감일', - required: false, - }) - @Type(() => Date) - @IsDate() - @IsOptional() - deadline?: Date; - - @ApiPropertyOptional({ - example: [1, 2], - description: '공지태그의 id', - required: false, - }) - @IsNumber({}, { each: true }) - @IsOptional() - tags: number[] = []; - - @ApiPropertyOptional({ - description: '공지 그룹의 id', - required: false, - enum: Category, - }) - @IsEnum(Category) - @IsOptional() - category?: Category; - - @ApiPropertyOptional({ - example: ['빼고', '테스트', '바랍니다'], - description: '이미지 파일 이름', - required: false, - }) - @IsString({ each: true }) - @IsOptional() - images: string[] = []; - - @ApiPropertyOptional({ - example: ['빼고', '테스트', '바랍니다'], - description: '파일 이름', - required: false, - }) - @IsString({ each: true }) - @IsOptional() - documents: string[] = []; - - @ApiPropertyOptional({ - example: '공지 그룹 id', - description: '공지 그룹 id', - required: false, - }) - @IsString() - @IsOptional() - groupId?: string; -} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { Category } from '@prisma/client'; +import { Type } from 'class-transformer'; +import { + IsDate, + IsEnum, + IsNotEmpty, + IsNumber, + IsOptional, + IsString, + MaxLength, +} from 'class-validator'; + +export class CreateNoticeDto { + @ApiProperty({ + example: '제목', + description: '공지 제목', + required: true, + }) + @IsString() + @IsNotEmpty() + @MaxLength(200) + title: string; + + @ApiProperty({ + example: '
내용<\\p>', + description: '공지 내용', + required: true, + }) + @IsString() + @IsNotEmpty() + @MaxLength(100000) + body: string; + + @ApiPropertyOptional({ + example: '2021-08-01T00:00:00.000Z', + description: '마감일', + required: false, + }) + @Type(() => Date) + @IsDate() + @IsOptional() + deadline?: Date; + + @ApiPropertyOptional({ + example: [1, 2], + description: '공지태그의 id', + required: false, + }) + @IsNumber({}, { each: true }) + @IsOptional() + tags: number[] = []; + + @ApiPropertyOptional({ + description: '공지 그룹의 id', + required: false, + enum: Category, + }) + @IsEnum(Category) + @IsOptional() + category?: Category; + + @ApiPropertyOptional({ + example: ['빼고', '테스트', '바랍니다'], + description: '이미지 파일 이름', + required: false, + }) + @IsString({ each: true }) + @IsOptional() + images: string[] = []; + + @ApiPropertyOptional({ + example: ['빼고', '테스트', '바랍니다'], + description: '파일 이름', + required: false, + }) + @IsString({ each: true }) + @IsOptional() + documents: string[] = []; + + @ApiPropertyOptional({ + example: '공지 그룹 id', + description: '공지 그룹 id', + required: false, + }) + @IsString() + @IsOptional() + groupId?: string; +} diff --git a/src/notice/dto/req/foreignContent.dto.ts b/apps/api/src/notice/dto/req/foreignContent.dto.ts similarity index 95% rename from src/notice/dto/req/foreignContent.dto.ts rename to apps/api/src/notice/dto/req/foreignContent.dto.ts index 2b43bd4..c533871 100644 --- a/src/notice/dto/req/foreignContent.dto.ts +++ b/apps/api/src/notice/dto/req/foreignContent.dto.ts @@ -1,42 +1,42 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; -import { IsDate, IsOptional, IsString, MaxLength } from 'class-validator'; - -export class ForeignContentDto { - @ApiProperty({ - example: 'en', - description: '언어', - required: true, - }) - @IsString() - lang: string; - - @ApiProperty({ - example: '제목', - description: '바뀐 제목 (현재 진짜로 바뀌지는 않음)', - required: false, - }) - @IsString() - @IsOptional() - @MaxLength(200) - title?: string; - - @ApiProperty({ - example: '영어 내용', - description: '영어로 된 내용', - required: true, - }) - @IsString() - @MaxLength(100000) - body: string; - - @ApiProperty({ - example: '2021-08-01T00:00:00.000Z', - description: '마감일, 가장 최근에 post한 것을 기준으로 설정됨', - required: false, - }) - @Type(() => Date) - @IsDate() - @IsOptional() - deadline?: Date; -} +import { ApiProperty } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; +import { IsDate, IsOptional, IsString, MaxLength } from 'class-validator'; + +export class ForeignContentDto { + @ApiProperty({ + example: 'en', + description: '언어', + required: true, + }) + @IsString() + lang: string; + + @ApiProperty({ + example: '제목', + description: '바뀐 제목 (현재 진짜로 바뀌지는 않음)', + required: false, + }) + @IsString() + @IsOptional() + @MaxLength(200) + title?: string; + + @ApiProperty({ + example: '영어 내용', + description: '영어로 된 내용', + required: true, + }) + @IsString() + @MaxLength(100000) + body: string; + + @ApiProperty({ + example: '2021-08-01T00:00:00.000Z', + description: '마감일, 가장 최근에 post한 것을 기준으로 설정됨', + required: false, + }) + @Type(() => Date) + @IsDate() + @IsOptional() + deadline?: Date; +} diff --git a/src/notice/dto/req/getAllNotice.dto.ts b/apps/api/src/notice/dto/req/getAllNotice.dto.ts similarity index 95% rename from src/notice/dto/req/getAllNotice.dto.ts rename to apps/api/src/notice/dto/req/getAllNotice.dto.ts index 8fcae77..4dc9e18 100644 --- a/src/notice/dto/req/getAllNotice.dto.ts +++ b/apps/api/src/notice/dto/req/getAllNotice.dto.ts @@ -1,90 +1,90 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { Category } from '@prisma/client'; -import { Type } from 'class-transformer'; -import { - IsArray, - IsEnum, - IsNumber, - IsOptional, - IsString, -} from 'class-validator'; - -export class GetAllNoticeQueryDto { - @ApiProperty({ - example: '0', - description: '넘길 공지의 개수', - required: false, - }) - @Type(() => Number) - @IsNumber() - @IsOptional() - offset?: number; - - @ApiProperty({ - example: '10', - description: '페이지당 공지 개수', - required: false, - }) - @Type(() => Number) - @IsNumber() - @IsOptional() - limit?: number; - - @ApiProperty({ - example: 'en', - description: '언어', - required: false, - }) - @IsString() - @IsOptional() - lang?: string; - - @ApiProperty({ - example: '제목', - description: '검색할 공지의 제목 혹은 내용', - required: false, - }) - @IsString() - @IsOptional() - search?: string; - - @ApiPropertyOptional({ - example: '이런', - description: '공지태그의 이름', - required: false, - }) - @IsArray() - @IsString({ each: true }) - @IsOptional() - tags?: string[]; - - @ApiProperty({ - example: 'deadline', - description: '정렬 기준 (deadline, hot, recent)', - required: false, - }) - @IsString() - @IsEnum(['deadline', 'hot', 'recent']) - @IsOptional() - orderBy?: 'recent' | 'deadline' | 'hot'; - - @ApiProperty({ - example: 'ETC', - description: '카테고리', - required: false, - }) - @IsString() - @IsEnum(Category) - @IsOptional() - category?: Category; - - @ApiProperty({ - example: 'own', - description: '공지 타입 (own, reminders)', - required: false, - }) - @IsString() - @IsEnum(['own', 'reminders']) - @IsOptional() - my?: 'own' | 'reminders'; -} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { Category } from '@prisma/client'; +import { Type } from 'class-transformer'; +import { + IsArray, + IsEnum, + IsNumber, + IsOptional, + IsString, +} from 'class-validator'; + +export class GetAllNoticeQueryDto { + @ApiProperty({ + example: '0', + description: '넘길 공지의 개수', + required: false, + }) + @Type(() => Number) + @IsNumber() + @IsOptional() + offset?: number; + + @ApiProperty({ + example: '10', + description: '페이지당 공지 개수', + required: false, + }) + @Type(() => Number) + @IsNumber() + @IsOptional() + limit?: number; + + @ApiProperty({ + example: 'en', + description: '언어', + required: false, + }) + @IsString() + @IsOptional() + lang?: string; + + @ApiProperty({ + example: '제목', + description: '검색할 공지의 제목 혹은 내용', + required: false, + }) + @IsString() + @IsOptional() + search?: string; + + @ApiPropertyOptional({ + example: '이런', + description: '공지태그의 이름', + required: false, + }) + @IsArray() + @IsString({ each: true }) + @IsOptional() + tags?: string[]; + + @ApiProperty({ + example: 'deadline', + description: '정렬 기준 (deadline, hot, recent)', + required: false, + }) + @IsString() + @IsEnum(['deadline', 'hot', 'recent']) + @IsOptional() + orderBy?: 'recent' | 'deadline' | 'hot'; + + @ApiProperty({ + example: 'ETC', + description: '카테고리', + required: false, + }) + @IsString() + @IsEnum(Category) + @IsOptional() + category?: Category; + + @ApiProperty({ + example: 'own', + description: '공지 타입 (own, reminders)', + required: false, + }) + @IsString() + @IsEnum(['own', 'reminders']) + @IsOptional() + my?: 'own' | 'reminders'; +} diff --git a/src/notice/dto/req/getGroupNotice.dto.ts b/apps/api/src/notice/dto/req/getGroupNotice.dto.ts similarity index 100% rename from src/notice/dto/req/getGroupNotice.dto.ts rename to apps/api/src/notice/dto/req/getGroupNotice.dto.ts diff --git a/src/notice/dto/req/getNotice.dto.ts b/apps/api/src/notice/dto/req/getNotice.dto.ts similarity index 95% rename from src/notice/dto/req/getNotice.dto.ts rename to apps/api/src/notice/dto/req/getNotice.dto.ts index 3ad9d72..aa02f57 100644 --- a/src/notice/dto/req/getNotice.dto.ts +++ b/apps/api/src/notice/dto/req/getNotice.dto.ts @@ -1,24 +1,24 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Transform } from 'class-transformer'; -import { IsBoolean, IsOptional, IsString } from 'class-validator'; - -export class GetNoticeDto { - @ApiProperty({ - example: 'true', - description: '공지를 읽었는지 여부, 기본값은 false', - required: false, - }) - @Transform(({ value }) => value === 'true') - @IsBoolean() - @IsOptional() - isViewed?: boolean; - - @ApiProperty({ - example: 'en', - description: '언어', - required: false, - }) - @IsString() - @IsOptional() - lang?: string; -} +import { ApiProperty } from '@nestjs/swagger'; +import { Transform } from 'class-transformer'; +import { IsBoolean, IsOptional, IsString } from 'class-validator'; + +export class GetNoticeDto { + @ApiProperty({ + example: 'true', + description: '공지를 읽었는지 여부, 기본값은 false', + required: false, + }) + @Transform(({ value }) => value === 'true') + @IsBoolean() + @IsOptional() + isViewed?: boolean; + + @ApiProperty({ + example: 'en', + description: '언어', + required: false, + }) + @IsString() + @IsOptional() + lang?: string; +} diff --git a/src/notice/dto/req/reaction.dto.ts b/apps/api/src/notice/dto/req/reaction.dto.ts similarity index 95% rename from src/notice/dto/req/reaction.dto.ts rename to apps/api/src/notice/dto/req/reaction.dto.ts index fb7c920..1a318ea 100644 --- a/src/notice/dto/req/reaction.dto.ts +++ b/apps/api/src/notice/dto/req/reaction.dto.ts @@ -1,12 +1,12 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsString } from 'class-validator'; - -export class ReactionDto { - @ApiProperty({ - example: '👍', - description: '반응할 이모지', - required: true, - }) - @IsString() - emoji: string; -} +import { ApiProperty } from '@nestjs/swagger'; +import { IsString } from 'class-validator'; + +export class ReactionDto { + @ApiProperty({ + example: '👍', + description: '반응할 이모지', + required: true, + }) + @IsString() + emoji: string; +} diff --git a/src/notice/dto/req/updateNotice.dto.ts b/apps/api/src/notice/dto/req/updateNotice.dto.ts similarity index 94% rename from src/notice/dto/req/updateNotice.dto.ts rename to apps/api/src/notice/dto/req/updateNotice.dto.ts index 9bc4ab1..2c56f3a 100644 --- a/src/notice/dto/req/updateNotice.dto.ts +++ b/apps/api/src/notice/dto/req/updateNotice.dto.ts @@ -1,51 +1,51 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; -import { - IsDate, - IsNotEmpty, - IsOptional, - IsString, - MaxLength, -} from 'class-validator'; - -export class UpdateNoticeDto { - @ApiProperty({ - example: '
내용<\\p>', - description: '공지 내용', - required: true, - }) - @IsString() - @IsNotEmpty() - @MaxLength(100000) - body: string; - - @ApiProperty({ - example: '2021-08-01T00:00:00.000Z', - description: '마감일', - required: false, - }) - @Type(() => Date) - @IsDate() - @IsOptional() - deadline?: Date; -} - -export class UpdateNoticeQueryDto { - @ApiProperty({ - example: 1, - description: 'Content IDX, Default: 1', - required: false, - }) - @IsString() - @IsOptional() - idx?: number; - - @ApiProperty({ - example: 'ko', - description: 'Language, Default: ko', - required: false, - }) - @IsString() - @IsOptional() - lang?: string; -} +import { ApiProperty } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; +import { + IsDate, + IsNotEmpty, + IsOptional, + IsString, + MaxLength, +} from 'class-validator'; + +export class UpdateNoticeDto { + @ApiProperty({ + example: '
내용<\\p>',
+ description: '공지 내용',
+ required: true,
+ })
+ @IsString()
+ @IsNotEmpty()
+ @MaxLength(100000)
+ body: string;
+
+ @ApiProperty({
+ example: '2021-08-01T00:00:00.000Z',
+ description: '마감일',
+ required: false,
+ })
+ @Type(() => Date)
+ @IsDate()
+ @IsOptional()
+ deadline?: Date;
+}
+
+export class UpdateNoticeQueryDto {
+ @ApiProperty({
+ example: 1,
+ description: 'Content IDX, Default: 1',
+ required: false,
+ })
+ @IsString()
+ @IsOptional()
+ idx?: number;
+
+ @ApiProperty({
+ example: 'ko',
+ description: 'Language, Default: ko',
+ required: false,
+ })
+ @IsString()
+ @IsOptional()
+ lang?: string;
+}
diff --git a/src/notice/dto/res/expandedGeneralNotice.dto.ts b/apps/api/src/notice/dto/res/expandedGeneralNotice.dto.ts
similarity index 100%
rename from src/notice/dto/res/expandedGeneralNotice.dto.ts
rename to apps/api/src/notice/dto/res/expandedGeneralNotice.dto.ts
diff --git a/src/notice/dto/res/generalNotice.dto.ts b/apps/api/src/notice/dto/res/generalNotice.dto.ts
similarity index 100%
rename from src/notice/dto/res/generalNotice.dto.ts
rename to apps/api/src/notice/dto/res/generalNotice.dto.ts
diff --git a/src/notice/notice.controller.ts b/apps/api/src/notice/notice.controller.ts
similarity index 98%
rename from src/notice/notice.controller.ts
rename to apps/api/src/notice/notice.controller.ts
index 2f8ca60..651e7e6 100644
--- a/src/notice/notice.controller.ts
+++ b/apps/api/src/notice/notice.controller.ts
@@ -23,11 +23,9 @@ import {
ApiUnauthorizedResponse,
} from '@nestjs/swagger';
import { NoticeService } from './notice.service';
-import { IdPGuard, IdPOptionalGuard } from 'src/user/guard/idp.guard';
import { GeneralNoticeListDto } from './dto/res/generalNotice.dto';
import { GetAllNoticeQueryDto } from './dto/req/getAllNotice.dto';
import { User } from '@prisma/client';
-import { GetUser } from 'src/user/decorator/get-user.decorator';
import { ExpandedGeneralNoticeDto } from './dto/res/expandedGeneralNotice.dto';
import { CreateNoticeDto } from './dto/req/createNotice.dto';
import { ForeignContentDto } from './dto/req/foreignContent.dto';
@@ -38,6 +36,8 @@ import {
} from './dto/req/updateNotice.dto';
import { AdditionalNoticeDto } from './dto/req/additionalNotice.dto';
import { GetGroupNoticeQueryDto } from './dto/req/getGroupNotice.dto';
+import { IdPGuard, IdPOptionalGuard } from '../user/guard/idp.guard';
+import { GetUser } from '../user/decorator/get-user.decorator';
@ApiTags('notice')
@ApiOAuth2(['email', 'profile', 'openid'], 'oauth2')
diff --git a/src/notice/notice.mapper.ts b/apps/api/src/notice/notice.mapper.ts
similarity index 100%
rename from src/notice/notice.mapper.ts
rename to apps/api/src/notice/notice.mapper.ts
diff --git a/src/notice/notice.module.ts b/apps/api/src/notice/notice.module.ts
similarity index 69%
rename from src/notice/notice.module.ts
rename to apps/api/src/notice/notice.module.ts
index 517933c..fe28307 100644
--- a/src/notice/notice.module.ts
+++ b/apps/api/src/notice/notice.module.ts
@@ -2,16 +2,16 @@ import { Module } from '@nestjs/common';
import { NoticeController } from './notice.controller';
import { NoticeService } from './notice.service';
import { NoticeRepository } from './notice.repository';
-import { UserModule } from 'src/user/user.module';
import { NoticeMapper } from './notice.mapper';
-import { ImageModule } from 'src/image/image.module';
-import { DocumentModule } from 'src/document/document.module';
-import { FileModule } from 'src/file/file.module';
-import { GroupModule } from 'src/group/group.module';
-import { FcmModule } from 'src/fcm/fcm.module';
import { PrismaModule } from '@lib/prisma';
import { LoggerModule } from '@lib/logger';
import { CustomConfigModule } from '@lib/custom-config';
+import { UserModule } from '../user/user.module';
+import { ImageModule } from '../image/image.module';
+import { DocumentModule } from '../document/document.module';
+import { FileModule } from '../file/file.module';
+import { GroupModule } from '../group/group.module';
+import { FcmModule } from '../fcm/fcm.module';
@Module({
imports: [
diff --git a/src/notice/notice.repository.ts b/apps/api/src/notice/notice.repository.ts
similarity index 95%
rename from src/notice/notice.repository.ts
rename to apps/api/src/notice/notice.repository.ts
index e833645..d396e13 100644
--- a/src/notice/notice.repository.ts
+++ b/apps/api/src/notice/notice.repository.ts
@@ -61,8 +61,8 @@ export class NoticeRepository {
crawls: {
some: {
OR: [
- { title: { contains: search } },
- { body: { contains: search } },
+ { title: { contains: search, mode: 'insensitive' } },
+ { body: { contains: search, mode: 'insensitive' } },
],
},
},
@@ -71,13 +71,17 @@ export class NoticeRepository {
contents: {
some: {
OR: [
- { title: { contains: search } },
- { body: { contains: search } },
+ { title: { contains: search, mode: 'insensitive' } },
+ { body: { contains: search, mode: 'insensitive' } },
],
},
},
},
- { tags: { some: { name: { contains: search } } } },
+ {
+ tags: {
+ some: { name: { contains: search, mode: 'insensitive' } },
+ },
+ },
],
}
: {}),
@@ -136,8 +140,8 @@ export class NoticeRepository {
crawls: {
some: {
OR: [
- { title: { contains: search } },
- { body: { contains: search } },
+ { title: { contains: search, mode: 'insensitive' } },
+ { body: { contains: search, mode: 'insensitive' } },
],
},
},
@@ -146,13 +150,17 @@ export class NoticeRepository {
contents: {
some: {
OR: [
- { title: { contains: search } },
- { body: { contains: search } },
+ { title: { contains: search, mode: 'insensitive' } },
+ { body: { contains: search, mode: 'insensitive' } },
],
},
},
},
- { tags: { some: { name: { contains: search } } } },
+ {
+ tags: {
+ some: { name: { contains: search, mode: 'insensitive' } },
+ },
+ },
],
}
: {}),
diff --git a/src/notice/notice.service.ts b/apps/api/src/notice/notice.service.ts
similarity index 96%
rename from src/notice/notice.service.ts
rename to apps/api/src/notice/notice.service.ts
index 0e843db..2c6bca6 100644
--- a/src/notice/notice.service.ts
+++ b/apps/api/src/notice/notice.service.ts
@@ -14,8 +14,6 @@ import { GetNoticeDto } from './dto/req/getNotice.dto';
import { ExpandedGeneralNoticeDto } from './dto/res/expandedGeneralNotice.dto';
import { NoticeFullContent } from './types/noticeFullContent';
import { CreateNoticeDto } from './dto/req/createNotice.dto';
-import { ImageService } from 'src/image/image.service';
-import { DocumentService } from 'src/document/document.service';
import { AdditionalNoticeDto } from './dto/req/additionalNotice.dto';
import { ForeignContentDto } from './dto/req/foreignContent.dto';
import { ReactionDto } from './dto/req/reaction.dto';
@@ -23,16 +21,18 @@ import {
UpdateNoticeDto,
UpdateNoticeQueryDto,
} from './dto/req/updateNotice.dto';
-import { FileService } from 'src/file/file.service';
-import { GroupService } from 'src/group/group.service';
-import { FcmService } from 'src/fcm/fcm.service';
-import { FcmTargetUser } from 'src/fcm/types/fcmTargetUser.type';
import { htmlToText } from 'html-to-text';
import { Notification } from 'firebase-admin/messaging';
import { GetGroupNoticeQueryDto } from './dto/req/getGroupNotice.dto';
import { Authority } from '../group/types/groupInfo.type';
import { Loggable } from '@lib/logger/decorator/loggable';
import { CustomConfigService } from '@lib/custom-config';
+import { ImageService } from '../image/image.service';
+import { DocumentService } from '../document/document.service';
+import { FileService } from '../file/file.service';
+import { GroupService } from '../group/group.service';
+import { FcmService } from '../fcm/fcm.service';
+import { FcmTargetUser } from '../fcm/types/fcmTargetUser.type';
@Injectable()
@Loggable()
diff --git a/src/notice/types/noticeFullContent.ts b/apps/api/src/notice/types/noticeFullContent.ts
similarity index 100%
rename from src/notice/types/noticeFullContent.ts
rename to apps/api/src/notice/types/noticeFullContent.ts
diff --git a/src/tag/dto/req/createTag.dto.ts b/apps/api/src/tag/dto/req/createTag.dto.ts
similarity index 100%
rename from src/tag/dto/req/createTag.dto.ts
rename to apps/api/src/tag/dto/req/createTag.dto.ts
diff --git a/src/tag/dto/req/getTag.dto.ts b/apps/api/src/tag/dto/req/getTag.dto.ts
similarity index 100%
rename from src/tag/dto/req/getTag.dto.ts
rename to apps/api/src/tag/dto/req/getTag.dto.ts
diff --git a/src/tag/dto/res/TagRes.dto.ts b/apps/api/src/tag/dto/res/TagRes.dto.ts
similarity index 100%
rename from src/tag/dto/res/TagRes.dto.ts
rename to apps/api/src/tag/dto/res/TagRes.dto.ts
diff --git a/src/tag/tag.controller.ts b/apps/api/src/tag/tag.controller.ts
similarity index 97%
rename from src/tag/tag.controller.ts
rename to apps/api/src/tag/tag.controller.ts
index a83c674..5bef3b7 100644
--- a/src/tag/tag.controller.ts
+++ b/apps/api/src/tag/tag.controller.ts
@@ -21,7 +21,7 @@ import {
import { GetTagDto } from './dto/req/getTag.dto';
import { CreateTagDto } from './dto/req/createTag.dto';
import { TagResDto } from './dto/res/TagRes.dto';
-import { IdPGuard } from 'src/user/guard/idp.guard';
+import { IdPGuard } from '../user/guard/idp.guard';
@ApiTags('tag')
@ApiOAuth2(['email', 'profile', 'openid'], 'oauth2')
diff --git a/src/tag/tag.module.ts b/apps/api/src/tag/tag.module.ts
similarity index 89%
rename from src/tag/tag.module.ts
rename to apps/api/src/tag/tag.module.ts
index a244f69..0b7cbf6 100644
--- a/src/tag/tag.module.ts
+++ b/apps/api/src/tag/tag.module.ts
@@ -2,9 +2,9 @@ import { Module } from '@nestjs/common';
import { TagController } from './tag.controller';
import { TagService } from './tag.service';
import { TagRepository } from './tag.repository';
-import { UserModule } from 'src/user/user.module';
import { PrismaModule } from '@lib/prisma';
import { LoggerModule } from '@lib/logger';
+import { UserModule } from '../user/user.module';
@Module({
imports: [PrismaModule, UserModule, LoggerModule],
diff --git a/src/tag/tag.repository.ts b/apps/api/src/tag/tag.repository.ts
similarity index 100%
rename from src/tag/tag.repository.ts
rename to apps/api/src/tag/tag.repository.ts
diff --git a/src/tag/tag.service.ts b/apps/api/src/tag/tag.service.ts
similarity index 100%
rename from src/tag/tag.service.ts
rename to apps/api/src/tag/tag.service.ts
diff --git a/src/user/decorator/get-idp-user.decorator.ts b/apps/api/src/user/decorator/get-idp-user.decorator.ts
similarity index 97%
rename from src/user/decorator/get-idp-user.decorator.ts
rename to apps/api/src/user/decorator/get-idp-user.decorator.ts
index 76ec88d..41efbe6 100644
--- a/src/user/decorator/get-idp-user.decorator.ts
+++ b/apps/api/src/user/decorator/get-idp-user.decorator.ts
@@ -1,9 +1,9 @@
-import { createParamDecorator, ExecutionContext } from '@nestjs/common';
-import { User } from '@prisma/client';
-
-export const GetIdPUser = createParamDecorator(
- (_data, ctx: ExecutionContext): User | undefined => {
- const req = ctx.switchToHttp().getRequest();
- return req.user?.idp;
- },
-);
+import { createParamDecorator, ExecutionContext } from '@nestjs/common';
+import { User } from '@prisma/client';
+
+export const GetIdPUser = createParamDecorator(
+ (_data, ctx: ExecutionContext): User | undefined => {
+ const req = ctx.switchToHttp().getRequest();
+ return req.user?.idp;
+ },
+);
diff --git a/src/user/decorator/get-token.decorator.ts b/apps/api/src/user/decorator/get-token.decorator.ts
similarity index 100%
rename from src/user/decorator/get-token.decorator.ts
rename to apps/api/src/user/decorator/get-token.decorator.ts
diff --git a/src/user/decorator/get-user.decorator.ts b/apps/api/src/user/decorator/get-user.decorator.ts
similarity index 97%
rename from src/user/decorator/get-user.decorator.ts
rename to apps/api/src/user/decorator/get-user.decorator.ts
index a86c597..06ee02d 100644
--- a/src/user/decorator/get-user.decorator.ts
+++ b/apps/api/src/user/decorator/get-user.decorator.ts
@@ -1,8 +1,8 @@
-import { createParamDecorator, ExecutionContext } from '@nestjs/common';
-
-export const GetUser = createParamDecorator(
- (_data, ctx: ExecutionContext): string | undefined => {
- const req = ctx.switchToHttp().getRequest();
- return req.user?.ziggle;
- },
-);
+import { createParamDecorator, ExecutionContext } from '@nestjs/common';
+
+export const GetUser = createParamDecorator(
+ (_data, ctx: ExecutionContext): string | undefined => {
+ const req = ctx.switchToHttp().getRequest();
+ return req.user?.ziggle;
+ },
+);
diff --git a/src/user/dto/req/login.dto.ts b/apps/api/src/user/dto/req/login.dto.ts
similarity index 77%
rename from src/user/dto/req/login.dto.ts
rename to apps/api/src/user/dto/req/login.dto.ts
index f0dbc42..12ec6d6 100644
--- a/src/user/dto/req/login.dto.ts
+++ b/apps/api/src/user/dto/req/login.dto.ts
@@ -1,5 +1,5 @@
import { IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator';
-import { LoginType, loginEnum } from 'src/user/types/login.type';
+import { loginEnum, LoginType } from '../../types/login.type';
export class LoginDto {
@IsString()
diff --git a/src/user/dto/req/logout.dto.ts b/apps/api/src/user/dto/req/logout.dto.ts
similarity index 100%
rename from src/user/dto/req/logout.dto.ts
rename to apps/api/src/user/dto/req/logout.dto.ts
diff --git a/src/user/dto/req/setFcmTokenReq.dto.ts b/apps/api/src/user/dto/req/setFcmTokenReq.dto.ts
similarity index 100%
rename from src/user/dto/req/setFcmTokenReq.dto.ts
rename to apps/api/src/user/dto/req/setFcmTokenReq.dto.ts
diff --git a/src/user/dto/res/jwtToken.dto.ts b/apps/api/src/user/dto/res/jwtToken.dto.ts
similarity index 100%
rename from src/user/dto/res/jwtToken.dto.ts
rename to apps/api/src/user/dto/res/jwtToken.dto.ts
diff --git a/src/user/dto/res/setFcmTokenRes.dto.ts b/apps/api/src/user/dto/res/setFcmTokenRes.dto.ts
similarity index 100%
rename from src/user/dto/res/setFcmTokenRes.dto.ts
rename to apps/api/src/user/dto/res/setFcmTokenRes.dto.ts
diff --git a/src/user/dto/res/userInfoRes.dto.ts b/apps/api/src/user/dto/res/userInfoRes.dto.ts
similarity index 100%
rename from src/user/dto/res/userInfoRes.dto.ts
rename to apps/api/src/user/dto/res/userInfoRes.dto.ts
diff --git a/src/user/guard/anonymous.strategy.ts b/apps/api/src/user/guard/anonymous.strategy.ts
similarity index 100%
rename from src/user/guard/anonymous.strategy.ts
rename to apps/api/src/user/guard/anonymous.strategy.ts
diff --git a/src/user/guard/idp.guard.ts b/apps/api/src/user/guard/idp.guard.ts
similarity index 100%
rename from src/user/guard/idp.guard.ts
rename to apps/api/src/user/guard/idp.guard.ts
diff --git a/src/user/guard/idp.strategy.ts b/apps/api/src/user/guard/idp.strategy.ts
similarity index 100%
rename from src/user/guard/idp.strategy.ts
rename to apps/api/src/user/guard/idp.strategy.ts
diff --git a/src/user/guard/idpOptional.strategy.ts b/apps/api/src/user/guard/idpOptional.strategy.ts
similarity index 100%
rename from src/user/guard/idpOptional.strategy.ts
rename to apps/api/src/user/guard/idpOptional.strategy.ts
diff --git a/src/user/types/jwtToken.type.ts b/apps/api/src/user/types/jwtToken.type.ts
similarity index 100%
rename from src/user/types/jwtToken.type.ts
rename to apps/api/src/user/types/jwtToken.type.ts
diff --git a/src/user/types/login.type.ts b/apps/api/src/user/types/login.type.ts
similarity index 100%
rename from src/user/types/login.type.ts
rename to apps/api/src/user/types/login.type.ts
diff --git a/src/user/user.controller.ts b/apps/api/src/user/user.controller.ts
similarity index 100%
rename from src/user/user.controller.ts
rename to apps/api/src/user/user.controller.ts
diff --git a/src/user/user.module.ts b/apps/api/src/user/user.module.ts
similarity index 100%
rename from src/user/user.module.ts
rename to apps/api/src/user/user.module.ts
diff --git a/src/user/user.repository.ts b/apps/api/src/user/user.repository.ts
similarity index 100%
rename from src/user/user.repository.ts
rename to apps/api/src/user/user.repository.ts
diff --git a/src/user/user.service.ts b/apps/api/src/user/user.service.ts
similarity index 100%
rename from src/user/user.service.ts
rename to apps/api/src/user/user.service.ts
diff --git a/test/app.e2e-spec.ts b/apps/api/test/app.e2e-spec.ts
similarity index 100%
rename from test/app.e2e-spec.ts
rename to apps/api/test/app.e2e-spec.ts
diff --git a/test/crawl/crawl.controller.integration.spec.ts b/apps/api/test/crawl/crawl.controller.integration.spec.ts
similarity index 100%
rename from test/crawl/crawl.controller.integration.spec.ts
rename to apps/api/test/crawl/crawl.controller.integration.spec.ts
diff --git a/test/crawl/crawl.controller.spec.ts b/apps/api/test/crawl/crawl.controller.spec.ts
similarity index 100%
rename from test/crawl/crawl.controller.spec.ts
rename to apps/api/test/crawl/crawl.controller.spec.ts
diff --git a/test/crawl/crawl.repository.spec.ts b/apps/api/test/crawl/crawl.repository.spec.ts
similarity index 100%
rename from test/crawl/crawl.repository.spec.ts
rename to apps/api/test/crawl/crawl.repository.spec.ts
diff --git a/test/crawl/crawl.service.spec.ts b/apps/api/test/crawl/crawl.service.spec.ts
similarity index 100%
rename from test/crawl/crawl.service.spec.ts
rename to apps/api/test/crawl/crawl.service.spec.ts
diff --git a/test/jest-e2e.json b/apps/api/test/jest-e2e.json
similarity index 100%
rename from test/jest-e2e.json
rename to apps/api/test/jest-e2e.json
diff --git a/apps/api/tsconfig.app.json b/apps/api/tsconfig.app.json
new file mode 100644
index 0000000..e2e0b2f
--- /dev/null
+++ b/apps/api/tsconfig.app.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "declaration": false,
+ "outDir": "../../dist/apps/api"
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
+}
diff --git a/apps/crawler/Dockerfile b/apps/crawler/Dockerfile
new file mode 100644
index 0000000..a90aeb7
--- /dev/null
+++ b/apps/crawler/Dockerfile
@@ -0,0 +1,32 @@
+#Step 1: Build the app in image 'builder'
+FROM node:21-alpine3.18 AS builder
+
+WORKDIR /app
+
+COPY package.json package-lock.json ./
+
+RUN apk update && \
+ apk add build-base libheif vips-dev vips -q
+RUN npm install && npm install --force @img/sharp-linuxmusl-arm64
+
+COPY . .
+
+RUN npx prisma generate
+
+RUN npx nest build crawler
+
+#Step 2: Copy the build from 'builder' to 'runner'
+FROM node:21-alpine3.18
+
+WORKDIR /app
+
+ENV TZ=Asia/Seoul
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
+ apk update && \
+ apk add build-base libheif vips-dev vips -q
+
+COPY --from=builder /app ./
+
+RUN npm install -D prisma --platform=linuxmusl
+
+CMD ["npm", "run", "start:crawler"]
diff --git a/apps/crawler/src/crawler.module.ts b/apps/crawler/src/crawler.module.ts
new file mode 100644
index 0000000..1796bbe
--- /dev/null
+++ b/apps/crawler/src/crawler.module.ts
@@ -0,0 +1,13 @@
+import { Module } from '@nestjs/common';
+import { CrawlerService } from './crawler.service';
+import { PrismaModule } from '@lib/prisma';
+import { HttpModule } from '@nestjs/axios';
+import { CrawlerRepository } from './crawler.repository';
+import { UserModule } from './user/user.module';
+
+@Module({
+ imports: [PrismaModule, HttpModule, UserModule],
+ providers: [CrawlerService, CrawlerRepository],
+ exports: [CrawlerService],
+})
+export class CrawlerModule {}
diff --git a/apps/crawler/src/crawler.repository.ts b/apps/crawler/src/crawler.repository.ts
new file mode 100644
index 0000000..a4b2364
--- /dev/null
+++ b/apps/crawler/src/crawler.repository.ts
@@ -0,0 +1,66 @@
+import { PrismaService } from '@lib/prisma';
+import { Injectable } from '@nestjs/common';
+import { Crawl, User } from '@prisma/client';
+
+@Injectable()
+export class CrawlerRepository {
+ constructor(private readonly prismaService: PrismaService) {}
+
+ async checkCrawlData(url: string): Promise