-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat : classification post list get api, 폴더별 post list get api 수정, 폴더 이름 list get api 에 정렬 적용 #39
Closed
Closed
Changes from 13 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9fb09d1
Merge branch 'feat/foler-api' into dev-deploy
Marades 89c27a1
Merge branch 'development' into dev-deploy
Marades cbb9130
Merge branch 'feat/foler-api' into dev-deploy
Marades 6329a8c
Merge branch 'feat/foler-api' into dev-deploy
Marades 25a8340
Feat : ai가 추천해주는 폴더로 post 모두 이동 api 구현
hye-on 9641e26
Chore : 스키마 이름 수정
hye-on 301c4b4
Feat : ai 분류 추천 리스트에서 링크 삭제 delete api 구현
hye-on db3cbe2
refactor : repository 생성
hye-on 316bbb3
Chore : dto import 누락 수정
hye-on 2634a65
refactor: method naming to camel-case
JonghunAn f818d60
Merge branch 'dev-deploy' into feature/ai-lambda
JonghunAn 48fb6e5
Merge pull request #36 from mash-up-kr/feature/ai-lambda
JonghunAn 7957b23
Feat : 폴더 이름 list에 정렬 추가
hye-on d89506b
Feat : 추천폴더별 링크 리스트에 페이지네이션 적용
hye-on ef224a2
Chore : controller.docs.ts에 ApiBearerAuth() 추가
hye-on 2e6ef65
Chore : classification 폴더 이름 리스트 response에 totalCounts(분류한 링크 개수) 추가
hye-on f032141
Chore : 폴더별 링크 리스트 get api 이름 수정
hye-on 8cfdc18
Chore : 분류 페이지 내 폴더 이름 get api 의 path 수정
hye-on 03c0d81
Chore : 링크 리스트 get api path 수정
hye-on f22fdb6
Feat : ai 분류 페이지 내 전체 post list get api 추가, 폴더 별 post list api 수정
hye-on d098a3f
Merge remote-tracking branch 'origin/dev-deploy' into feature/classif…
hye-on 797db2b
env : 윈도우 이슈로 수정..
hye-on 024a732
Feat: Add count classified count API
J-Hoplin 5500975
Merge branch 'feature/classification-list-api' of https://github.com/…
J-Hoplin d9d635e
Chore: Pnpm conflict
J-Hoplin f605f08
Fix: Modify method name of countClassifiedPost(controller, service, r…
J-Hoplin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Injectable, InternalServerErrorException } from '@nestjs/common'; | ||
import { InjectModel } from '@nestjs/mongoose'; | ||
import { Model, Types, Schema } from 'mongoose'; | ||
import { AIClassification, Folder } from '@src/infrastructure'; | ||
import { ClassificationFolderWithCount } from './dto/classification.dto'; | ||
|
||
@Injectable() | ||
export class ClassficiationRepository { | ||
constructor( | ||
@InjectModel(AIClassification.name) | ||
private readonly aiClassificationModel: Model<AIClassification>, | ||
) {} | ||
|
||
async findContainedFolderByUserId( | ||
userId: Types.ObjectId, | ||
): Promise<ClassificationFolderWithCount[]> { | ||
return await this.aiClassificationModel | ||
.aggregate([ | ||
{ | ||
$match: { | ||
deletedAt: null, | ||
}, | ||
}, | ||
{ | ||
$lookup: { | ||
from: 'folders', | ||
localField: 'suggestedFolderId', | ||
foreignField: '_id', | ||
as: 'folder', | ||
}, | ||
}, | ||
{ | ||
$unwind: '$folder', | ||
}, | ||
{ | ||
$match: { | ||
'folder.userId': userId, | ||
}, | ||
}, | ||
{ | ||
$group: { | ||
_id: '$suggestedFolderId', | ||
folderName: { $first: '$folder.name' }, | ||
postCount: { $sum: 1 }, | ||
folderCreatedAt: { $first: '$folder.createdAt' }, | ||
}, | ||
}, | ||
{ | ||
$sort: { | ||
postCount: -1, | ||
folderCreatedAt: -1, | ||
}, | ||
}, | ||
{ | ||
$project: { | ||
_id: 0, | ||
folderId: { $toString: '$_id' }, | ||
folderName: 1, | ||
postCount: 1, | ||
}, | ||
}, | ||
]) | ||
.exec(); | ||
} | ||
|
||
async delete(id: string) { | ||
await this.aiClassificationModel | ||
.findByIdAndUpdate(id, { deletedAt: new Date() }) | ||
.exec(); | ||
} | ||
|
||
async deleteBySuggestedFolderId(suggestedFolderId: string) { | ||
await this.aiClassificationModel | ||
.updateMany( | ||
{ suggestedFolderId: suggestedFolderId, deletedAt: null }, | ||
{ $set: { deletedAt: new Date() } }, | ||
) | ||
.exec(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; | ||
|
||
export const ClassificationControllerDocs = applyDecorators( | ||
ApiTags('AI classification API'), | ||
ApiBearerAuth(), | ||
); |
13 changes: 13 additions & 0 deletions
13
src/modules/classification/docs/deleteAIClassification.docs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiBearerAuth, ApiOperation, ApiResponse } from '@nestjs/swagger'; | ||
import { AIFolderNameListResponse } from '../response/ai-folder-list.dto'; | ||
|
||
export const DeleteAIClassificationDocs = applyDecorators( | ||
ApiOperation({ | ||
summary: 'ai 분류 추천 리스트에서 삭제', | ||
description: | ||
'ai 분류 추천 리스트에서 삭제합니다. 나중에 읽을 폴더에 계속 위치됩니다.', | ||
}), | ||
ApiResponse({}), | ||
ApiBearerAuth(), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './controller.docs'; | ||
export * from './getAIFolderNameList.docs'; | ||
export * from './getAIPostList.docs'; | ||
export * from './patchAIPost.docs'; | ||
export * from './deleteAIClassification.docs'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이전 pr에 있는 내용..