Skip to content

Commit

Permalink
refactor: ♻️ coalition model 을 page/common/model 로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
jpham005 committed Oct 29, 2023
1 parent 65c1921 commit 0df2ed2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 37 deletions.
4 changes: 3 additions & 1 deletion app/src/api/coalition/coalition.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { InjectModel } from '@nestjs/mongoose';
import type { Aggregate, Model } from 'mongoose';
import { API_CONFIG } from 'src/config/api';
import { CDN_CONFIG } from 'src/config/cdn';
import type { Coalition } from '../../page/common/models/coalition.model';
import { coalition } from './db/coalition.database.schema';
import type { Coalition } from './models/coalition.model';

@Injectable()
export class CoalitionService {
Expand All @@ -26,7 +26,9 @@ export class CoalitionService {
return {
...dao,
coverUrl: this.coverUrlById(dao.id),
// todo: deprecated at v0.9.0
imageUrl: this.imageUrlById(dao.id),
imgUrl: this.imageUrlById(dao.id),
color: dao.color ?? '#161616',
};
}
Expand Down
28 changes: 0 additions & 28 deletions app/src/api/coalition/models/coalition.model.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/common/userFullProfile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Coalition } from 'src/api/coalition/models/coalition.model';
import type { Coalition } from 'src/page/common/models/coalition.model';
import type { cursus_user } from 'src/api/cursusUser/db/cursusUser.database.schema';
import type { title } from 'src/api/title/db/title.database.schema';
import type { titles_user } from 'src/api/titlesUser/db/titlesUser.database.schema';
Expand Down
34 changes: 34 additions & 0 deletions app/src/page/common/models/coalition.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Field, ObjectType } from '@nestjs/graphql';

@ObjectType()
export class Coalition {
@Field()
id: number;

@Field()
name: string;

@Field({ deprecationReason: 'deprecated at v0.9.0' })
slug: string;

@Field({ deprecationReason: 'deprecated at v0.9.0, imgUrl 을 사용하세요.' })
imageUrl: string;

@Field()
imgUrl: string;

@Field()
coverUrl: string;

@Field()
color: string;

@Field({ deprecationReason: 'deprecated at v0.9.0' })
score: number;

@Field({
description: '코알리숑 마스터의 user id 입니다.',
deprecationReason: 'deprecated at v0.9.0',
})
userId: number;
}
2 changes: 1 addition & 1 deletion app/src/page/home/coalition/models/home.coalition.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, ObjectType } from '@nestjs/graphql';
import { Coalition } from 'src/api/coalition/models/coalition.model';
import { Coalition } from 'src/page/common/models/coalition.model';
import { IntRecord } from 'src/common/models/common.valueRecord.model';
import { ArrayDateRanged } from 'src/dateRange/models/dateRange.model';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InternalServerErrorException } from '@nestjs/common';
import type { Coalition } from 'src/api/coalition/models/coalition.model';
import type { Coalition } from 'src/page/common/models/coalition.model';

export type PokemonType = {
readonly name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, Float, ObjectType } from '@nestjs/graphql';
import { Coalition } from 'src/api/coalition/models/coalition.model';
import { Coalition } from 'src/page/common/models/coalition.model';

@ObjectType()
export class UserTitle {
Expand Down
9 changes: 5 additions & 4 deletions app/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ type ProjectPreview {
type Coalition {
id: Int!
name: String!
slug: String!
imageUrl: String!
slug: String! @deprecated(reason: "deprecated at v0.9.0")
imageUrl: String! @deprecated(reason: "deprecated at v0.9.0, imgUrl 을 사용하세요.")
imgUrl: String!
coverUrl: String!
color: String!
score: Int!
score: Int! @deprecated(reason: "deprecated at v0.9.0")

"""코알리숑 마스터의 user id 입니다."""
userId: Int!
userId: Int! @deprecated(reason: "deprecated at v0.9.0")
}

type UserTitle {
Expand Down

0 comments on commit 0df2ed2

Please sign in to comment.