Skip to content

Commit

Permalink
constants 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
neverlish committed Jun 23, 2023
1 parent 5777355 commit cce8b89
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 44 deletions.
4 changes: 3 additions & 1 deletion src/dao/ReviewDao.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NotMatchedError, DuplicatedEntryError } from '@errors';
import { ACCESS_PUBLIC, ACCESS_PRIVATE } from '@utils/constants';

import {
sequelize,
Expand All @@ -11,6 +10,9 @@ import {
} from '@sequelize';
import { Op, Order, QueryTypes } from 'sequelize';

const ACCESS_PUBLIC: number = 1;
const ACCESS_PRIVATE: number = 0;

const SQL_READ_ALL_OF_PERFUME = `
SELECT
r.id as reviewIdx,
Expand Down
16 changes: 8 additions & 8 deletions src/service/NoteService.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import NoteDao from '@src/dao/NoteDao';
import { NoteDTO } from '@src/data/dto';
import {
NOTE_TYPE_BASE,
NOTE_TYPE_MIDDLE,
NOTE_TYPE_SINGLE,
NOTE_TYPE_TOP,
PERFUME_NOTE_TYPE_NORMAL,
PERFUME_NOTE_TYPE_SINGLE,
} from '@src/utils/constants';

interface NoteDict {
top: string;
Expand All @@ -16,6 +8,14 @@ interface NoteDict {
single: string;
}

const NOTE_TYPE_TOP: number = 1;
const NOTE_TYPE_MIDDLE: number = 2;
const NOTE_TYPE_BASE: number = 3;
const NOTE_TYPE_SINGLE: number = 4;

const PERFUME_NOTE_TYPE_SINGLE: number = 1;
const PERFUME_NOTE_TYPE_NORMAL: number = 0;

export class NoteService {
noteDao: NoteDao;
constructor(noteDao?: NoteDao) {
Expand Down
3 changes: 2 additions & 1 deletion src/service/SeriesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
SeriesFilterDTO,
IngredientCategoryDTO,
} from '@dto/index';
import { THRESHOLD_CATEGORY } from '@src/utils/constants';
import { Op } from 'sequelize';
import { ETC } from '@src/utils/strings';

const LOG_TAG: string = '[Series/Service]';

const THRESHOLD_CATEGORY: number = 10;

class SeriesService {
seriesDao: SeriesDao;
ingredientDao: IngredientDao;
Expand Down
34 changes: 0 additions & 34 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import {
NONE,
EAU_DE_COLOGNE,
EAU_DE_TOILETTE,
EAU_DE_PERFUME,
PERFUME,
ETC,
TOP,
MIDDLE,
BASE,
SINGLE,
} from '@utils/strings';

const GENDER_MAN: number = 1;
Expand All @@ -31,29 +26,14 @@ const ABUNDANCE_RATE_STR_DICT: { [key: string]: string } = new Proxy<{
}
);

const NOTE_TYPE_TOP: number = 1;
const NOTE_TYPE_MIDDLE: number = 2;
const NOTE_TYPE_BASE: number = 3;
const NOTE_TYPE_SINGLE: number = 4;
const NOTE_TYPE_LIST: string[] = [NONE, TOP, MIDDLE, BASE, SINGLE];
const PERFUME_NOTE_TYPE_SINGLE: number = 1;
const PERFUME_NOTE_TYPE_NORMAL: number = 0;
const MIN_SCORE: number = 0;
const MAX_SCORE: number = 10;
const DEFAULT_PAGE_SIZE: number = 100;
const THRESHOLD_CATEGORY: number = 10;

const DEFAULT_RECOMMEND_REQUEST_SIZE: number = 7;
const DEFAULT_NEW_PERFUME_REQUEST_SIZE: number = 50;
const DEFAULT_SIMILAR_PERFUMES_REQUEST_SIZE: number = 20;
const DEFAULT_RECENT_ADDED_PERFUME_REQUEST_SIZE: number = 7;
const DEFAULT_RECOMMEND_COMMON_REQUEST_SIZE: number = 15;
const DEFAULT_BRAND_REQUEST_SIZE: number = 1000;
const DEFAULT_INGREDIENT_REQUEST_SIZE: number = 2000;
const DEFAULT_OP_CODE: number = 0;

const ACCESS_PUBLIC: number = 1;
const ACCESS_PRIVATE: number = 0;

export {
GENDER_MAN,
Expand All @@ -62,25 +42,11 @@ export {
GRADE_MANAGER,
GRADE_SYSTEM_ADMIN,
ABUNDANCE_RATE_STR_DICT,
NOTE_TYPE_TOP,
NOTE_TYPE_MIDDLE,
NOTE_TYPE_BASE,
NOTE_TYPE_SINGLE,
NOTE_TYPE_LIST,
PERFUME_NOTE_TYPE_SINGLE,
PERFUME_NOTE_TYPE_NORMAL,
MIN_SCORE,
MAX_SCORE,
DEFAULT_PAGE_SIZE,
THRESHOLD_CATEGORY,
DEFAULT_RECOMMEND_REQUEST_SIZE,
DEFAULT_NEW_PERFUME_REQUEST_SIZE,
DEFAULT_RECENT_ADDED_PERFUME_REQUEST_SIZE,
DEFAULT_SIMILAR_PERFUMES_REQUEST_SIZE,
DEFAULT_RECOMMEND_COMMON_REQUEST_SIZE,
DEFAULT_BRAND_REQUEST_SIZE,
DEFAULT_INGREDIENT_REQUEST_SIZE,
ACCESS_PUBLIC,
ACCESS_PRIVATE,
DEFAULT_OP_CODE,
};

0 comments on commit cce8b89

Please sign in to comment.