Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE `Cafe` ADD COLUMN `naverMap` VARCHAR(191) NULL;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ model Cafe {
longitude Float // GPS 경도
// openHours String? // 영업 시간 // 좀 더 세분화 필요
instagram String? // 가게 인스타 계정 링크
naverMap String? // 가게 네이버지도 링크
phone String? // 가게 연락처
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand Down
2 changes: 1 addition & 1 deletion src/cafe/cafe.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
ApiUnauthorizedResponse,
} from '@nestjs/swagger';
import { PreferenceStatusDto } from './dto/res/preferenceStatus.dto';
import { SwipeCafeListResDto } from './dto/res/switeCafeListRes.dto';
import { SwipeCafeListResDto } from './dto/res/swifeCafeListRes.dto';
import { GetSwipeCafeListDto } from './dto/req/getSwipeCafeList.dto';

@Controller('cafe')
Expand Down
4 changes: 2 additions & 2 deletions src/cafe/cafe.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class CafeRepository {
): Promise<GeneralCafeResDto[]> {
const cafeList = await this.prismaService.$queryRaw<GeneralCafeResDto[]>`
SELECT
c.id, c.name, c.address, c.latitude, c.longitude, c.instagram, c.phone, c.createdAt,
c.id, c.name, c.address, c.latitude, c.longitude, c.instagram, c.naverMap, c.phone, c.createdAt,
CASE
WHEN COUNT(i.id) = 0 THEN JSON_ARRAY()
ELSE JSON_ARRAYAGG(
Expand Down Expand Up @@ -210,7 +210,7 @@ export class CafeRepository {

const rawResult = await this.prismaService.$queryRaw<GeneralCafeResDto[]>`
SELECT
c.id, c.name, c.address, c.latitude, c.longitude, c.instagram, c.phone, c.createdAt,
c.id, c.name, c.address, c.latitude, c.longitude, c.instagram, c.naverMap, c.phone, c.createdAt,
CASE
WHEN COUNT(i.id) = 0 THEN JSON_ARRAY()
ELSE JSON_ARRAYAGG(
Expand Down
2 changes: 1 addition & 1 deletion src/cafe/cafe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { GetNearCafeListDto } from './dto/req/getNearCafeList.dto';
import { GeneralCafeResDto } from './dto/res/generalCafe.dto';
import { SetCafePreferenceDto } from './dto/req/setCafePreference.dto';
import { User } from '@prisma/client';
import { SwipeCafeListResDto } from './dto/res/switeCafeListRes.dto';
import { SwipeCafeListResDto } from './dto/res/swifeCafeListRes.dto';
import { GetSwipeCafeListDto } from './dto/req/getSwipeCafeList.dto';
import { ImageService } from 'src/image/image.service';

Expand Down
24 changes: 22 additions & 2 deletions src/cafe/dto/req/createCafe.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
import {
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
IsUrl,
} from 'class-validator';

export class CreateCafeDto {
@ApiProperty({
Expand Down Expand Up @@ -42,15 +48,29 @@ export class CreateCafeDto {
type: String,
description: "Cafe's Instagram Link",
example: 'https://www.instagram.com/cafe_baleine',
required: false,
})
@IsUrl({ protocols: ['http', 'https'], require_protocol: true })
@IsString()
@IsOptional()
instagram?: string;

@ApiProperty({
type: String,
description: "Cafe's Navermap Link",
example: 'https://naver.me/G2EI8IYr',
required: false,
})
@IsUrl({ protocols: ['http', 'https'], require_protocol: true })
@IsString()
@IsOptional()
naverMap?: string;

@ApiProperty({
type: String,
description: "Cafe's Phone number",
example: '02-1234-5678',
required: false,
})
@IsString()
@IsOptional()
Expand All @@ -59,7 +79,7 @@ export class CreateCafeDto {
@ApiProperty({
type: Array<string>,
description: 'Image file s3 key list',
example: ['path1/image1.png', 'path1/image2.png'],
example: ['staging/1739171538853-x51z517a99e006.png'],
required: false,
})
@IsString({ each: true })
Expand Down
16 changes: 16 additions & 0 deletions src/cafe/dto/res/generalCafe.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
IsNumber,
IsOptional,
IsString,
IsUrl,
} from 'class-validator';

export class GeneralCafeResDto {
Expand Down Expand Up @@ -58,15 +59,29 @@ export class GeneralCafeResDto {
type: String,
description: "Cafe's Instagram Link",
example: 'https://www.instagram.com/cafe_baleine',
required: false,
})
@IsUrl({ protocols: ['http', 'https'], require_protocol: true })
@IsString()
@IsOptional()
instagram?: string;

@ApiProperty({
type: String,
description: "Cafe's Navermap Link",
example: 'https://naver.me/G2EI8IYr',
required: false,
})
@IsUrl({ protocols: ['http', 'https'], require_protocol: true })
@IsString()
@IsOptional()
naverMap?: string;

@ApiProperty({
type: String,
description: "Cafe's Phone number",
example: '02-1234-5678',
required: false,
})
@IsString()
@IsOptional()
Expand All @@ -84,6 +99,7 @@ export class GeneralCafeResDto {
createdAt: '2025-01-30T15:34:28.284Z',
},
],
required: false,
})
@IsString({ each: true })
@IsOptional()
Expand Down
10 changes: 10 additions & 0 deletions src/cafe/dto/res/preferenceStatus.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
import { PreferenceStatus } from '@prisma/client';
import { IsDate, IsEnum, IsNotEmpty } from 'class-validator';

export class PreferenceStatusDto {
@ApiProperty({
Expand All @@ -8,7 +9,16 @@ export class PreferenceStatusDto {
description: 'Preference Status of Cafe(LIKE, DISLIKE, HOLD)',
example: PreferenceStatus.LIKE,
})
@IsEnum(PreferenceStatus)
@IsNotEmpty()
status: PreferenceStatus;

@ApiProperty({
type: Date,
description: "Cafe's created Date",
example: '2025-01-30T15:34:28.284Z',
})
@IsDate()
@IsNotEmpty()
updatedAt: Date;
}