Skip to content

Commit

Permalink
style: 코드 포맷팅
Browse files Browse the repository at this point in the history
  • Loading branch information
Miensoap committed Nov 6, 2024
1 parent ef8cc25 commit 1aed12b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
9 changes: 7 additions & 2 deletions backend/src/common/SoftDeleteRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { SoftDeletableEntity, Key } from './SoftDeletableEntity.interface';
* Soft Delete 를 지원
* 기본적으로 deletedAt 이 null 인 것만 조회
*/
export abstract class SoftDeleteRepository<T extends SoftDeletableEntity<K>, K extends Key> extends Repository<T> {
export abstract class SoftDeleteRepository<
T extends SoftDeletableEntity<K>,
K extends Key,
> extends Repository<T> {
find(options: FindManyOptions<T> = {}) {
return super.find({
...options,
Expand Down Expand Up @@ -60,6 +63,8 @@ export abstract class SoftDeleteRepository<T extends SoftDeletableEntity<K>, K e
}

existById(id: K) {
return this.count({ where: { id } as FindOptionsWhere<T> }).then((count) => count > 0);
return this.count({ where: { id } as FindOptionsWhere<T> }).then(
(count) => count > 0,
);
}
}
21 changes: 18 additions & 3 deletions backend/src/map/map.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { Controller, Get, Post, Body, Query, Delete, Param, Patch } from '@nestjs/common';
import {
Controller,
Get,
Post,
Body,
Query,
Delete,
Param,
Patch,
} from '@nestjs/common';
import { MapService } from './map.service';
import { CreateMapRequest } from './dto/CreateMapRequest';
import { UpdateMapInfoRequest } from './dto/UpdateMapInfoRequest';
Expand Down Expand Up @@ -35,13 +44,19 @@ export class MapController {
}

@Patch('/:id/info')
async updateMapInfo(@Param('id') id: number, @Body() updateMapForm: UpdateMapInfoRequest) {
async updateMapInfo(
@Param('id') id: number,
@Body() updateMapForm: UpdateMapInfoRequest,
) {
await this.appService.updateMapInfo(id, updateMapForm);
return { id, ...updateMapForm };
}

@Patch('/:id/visibility')
async updateMapVisibility(@Param('id') id: number, @Body('isPublic') isPublic: boolean) {
async updateMapVisibility(
@Param('id') id: number,
@Body('isPublic') isPublic: boolean,
) {
await this.appService.updateMapVisibility(id, isPublic);
return { id, isPublic };
}
Expand Down
9 changes: 7 additions & 2 deletions backend/src/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export class MapService {
where: { user: { id: userId } },
});

const ownMaps = await this.mapRepository.findByUserId(userId, page, pageSize);
const ownMaps = await this.mapRepository.findByUserId(
userId,
page,
pageSize,
);

return {
maps: await Promise.all(ownMaps.map(MapListResponse.from)),
Expand Down Expand Up @@ -90,6 +94,7 @@ export class MapService {
}

private async checkExists(id: number) {
if (!(await this.mapRepository.existById(id))) throw new MapNotFoundException(id);
if (!(await this.mapRepository.existById(id)))
throw new MapNotFoundException(id);
}
}

0 comments on commit 1aed12b

Please sign in to comment.