Skip to content

Commit

Permalink
feat(tag): 메인 페이지 용 태그 조회 레포지토리 함수 추가
Browse files Browse the repository at this point in the history
메인 페이지 용 태그 조회 레포지토리 함수 추가
  • Loading branch information
nyj001012 committed Aug 1, 2023
1 parent 00f7905 commit d6e06fe
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions backend/src/v1/tags/tags.repository.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
/* eslint-disable max-classes-per-file */
import {
In, QueryRunner, Repository,
} from 'typeorm';
import { In, QueryRunner, Repository } from 'typeorm';
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity.js';
import jipDataSource from '~/app-data-source';
import {
BookInfo,
SubTag,
SuperTag,
User,
VTagsSubDefault,
BookInfo, SubTag, SuperTag, User, VTagsSubDefault, VTagsSuperDefault,
} from '~/entity/entities';
import { subDefaultTag, superDefaultTag } from '../DTO/tags.model';

Expand Down Expand Up @@ -95,6 +89,8 @@ export class SuperTagRepository extends Repository<SuperTag> {

private readonly bookInfoRepo: Repository<BookInfo>;

private readonly vSuperDefaultRepo: Repository<VTagsSuperDefault>;

private readonly entityManager;

constructor(transactionQueryRunner?: QueryRunner) {
Expand All @@ -114,6 +110,10 @@ export class SuperTagRepository extends Repository<SuperTag> {
BookInfo,
this.entityManager,
);
this.vSuperDefaultRepo = new Repository<VTagsSuperDefault>(
VTagsSuperDefault,
this.entityManager,
);
}

async getSuperTagLogin(superTagId: number): Promise<string | null> {
Expand Down Expand Up @@ -225,4 +225,10 @@ export class SuperTagRepository extends Repository<SuperTag> {
});
return count;
}

async getMainTags(limit: number): Promise<VTagsSuperDefault[]> {
return this.vSuperDefaultRepo.find({
take: limit,
});
}
}

0 comments on commit d6e06fe

Please sign in to comment.