Skip to content

[25.06.03 / TASK-191]Feature - 전체 조회수/좋아요/게시글 디테일 API 대응개발 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 3, 2025
Merged
250 changes: 235 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Node.js 기본
node_modules/
pnpm-debug.log*

# 환경 변수 및 인증 정보
.env
.env.local
Expand All @@ -17,22 +13,246 @@ dist/
*.swp
*.swo

# OS별 시스템 파일
.DS_Store
Thumbs.db

# 로그 파일
logs/*
*.log
*.gz
*.out

# 빌드 및 캐시 파일
.cache/
build/
temp/
tmp/
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,visualstudiocode,node,git
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,visualstudiocode,node,git

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# 테스트 출력
coverage/
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/macos,windows,visualstudiocode,node,git
2 changes: 1 addition & 1 deletion src/controllers/leaderboard.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GetPostLeaderboardQuery,
UserLeaderboardResponseDto,
PostLeaderboardResponseDto,
} from '@/types/index';
} from '@/types';

export class LeaderboardController {
constructor(private leaderboardService: LeaderboardService) {}
Expand Down
21 changes: 6 additions & 15 deletions src/controllers/noti.controller.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
import { NextFunction, Request, RequestHandler, Response } from 'express';
import logger from '@/configs/logger.config';
import { NotiService } from "@/services/noti.service";
import { NotiPostsResponseDto } from "@/types/dto/responses/notiResponse.type";
import { NotiService } from '@/services/noti.service';
import { NotiPostsResponseDto } from '@/types/dto/responses/notiResponse.type';

export class NotiController {
constructor(private notiService: NotiService) { }
constructor(private notiService: NotiService) {}

getAllNotiPosts: RequestHandler = async (
req: Request,
res: Response<NotiPostsResponseDto>,
next: NextFunction,
) => {
getAllNotiPosts: RequestHandler = async (req: Request, res: Response<NotiPostsResponseDto>, next: NextFunction) => {
try {
const result = await this.notiService.getAllNotiPosts();
const response = new NotiPostsResponseDto(
true,
'전체 noti post 조회에 성공하였습니다.',
{ posts: result },
null,
);
const response = new NotiPostsResponseDto(true, '전체 noti post 조회에 성공하였습니다.', { posts: result }, null);
res.status(200).json(response);
} catch (error) {
logger.error('전체 조회 실패:', error);
next(error);
}
};
}
}
2 changes: 1 addition & 1 deletion src/controllers/post.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@/types';

export class PostController {
constructor(private postService: PostService) { }
constructor(private postService: PostService) {}

getAllPosts: RequestHandler = async (
req: Request<object, object, object, GetAllPostsQuery>,
Expand Down
29 changes: 29 additions & 0 deletions src/controllers/totalStats.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { NextFunction, Request, RequestHandler, Response } from 'express';
import logger from '@/configs/logger.config';
import { GetTotalStatsQuery, TotalStatsResponseDto } from '@/types';
import { TotalStatsService } from '@/services/totalStats.service';

export class TotalStatsController {
constructor(private totalStatsService: TotalStatsService) {}

getTotalStats: RequestHandler = async (
req: Request<object, object, object, GetTotalStatsQuery>,
res: Response<TotalStatsResponseDto>,
next: NextFunction,
) => {
try {
const { id } = req.user;
const { period, type } = req.query;

const stats = await this.totalStatsService.getTotalStats(id, period, type);
const message = this.totalStatsService.getSuccessMessage(type);

const response = new TotalStatsResponseDto(true, message, stats, null);

res.status(200).json(response);
} catch (error) {
logger.error('전체 통계 조회 실패:', error);
next(error);
}
};
}
Loading
Loading