Skip to content

Commit

Permalink
Merge branch 'devkor-project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
overthestream authored Sep 19, 2023
2 parents ef0e73c + 4f25441 commit 558c43a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/services/categoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const getCategoryList = async (userId: number): Promise<ServiceResult<cat
.innerJoinAndSelect('cp.category', 'c')
.select(['c.categoryId AS categoryId', 'c.categoryName AS categoryName', 'c.provider AS provider'])
.where('cp.userId = :userId', { userId })
.orderBy('c.provider')
.getRawMany();

logger.info('get category list success', userId, result);
Expand Down
1 change: 1 addition & 0 deletions src/services/noticeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const getHotNotices = async function (userId: number):
.addSelect('c.categoryName AS categoryName')
.addSelect('case when n.noticeId = sc.noticeId then \'Y\' else \'N\' end as isScraped')
.orderBy('n.viewCount', 'DESC')
.where('date BETWEEN DATE_ADD(NOW(),INTERVAL -30 DAY ) AND NOW()')
.limit(20)
.getRawMany();

Expand Down
2 changes: 1 addition & 1 deletion src/services/scrapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getScraps = async function (userId: number):
.where('u.userId = :userId', { userId }), 'sc', 'n.noticeId = sc.noticeId')
.innerJoin('n.scraps', 's')
.innerJoin('s.user', 'u')
.select(['n.noticeId AS noticeId', 'n.title AS title', 'n.date AS date', 'n.provider AS provider', 'n.viewCount AS viewCount'])
.select(['n.noticeId AS noticeId', 'n.title AS title', 'date_format(n.date, \'%Y-%m-%d\') as date', 'n.provider AS provider', 'n.viewCount AS viewCount'])
.addSelect('c.categoryName AS categoryName')
.addSelect('case when n.noticeId = sc.noticeId then \'Y\' else \'N\' end as isScraped')
.where('u.userId = :userId', { userId })
Expand Down
6 changes: 5 additions & 1 deletion src/services/userService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logger from '@/config/winston';
import User from '@/entities/User';
import ServiceResult from '@/interfaces/common';
import { EMAIL_NOT_EXISTS } from '@/interfaces/error';
import { EMAIL_NOT_EXISTS, NOT_KOREA } from '@/interfaces/error';
import { userInfoDto } from '@/interfaces/userDto';

export const getUserInfo = async (userId: number):
Expand Down Expand Up @@ -34,6 +34,10 @@ export const modifyUserInfo = async (userId: number, modifiedInfo: userInfoDto):
if (!user) {
throw EMAIL_NOT_EXISTS;
}
const regex = /[a-z0-9][email protected]/;
if (!regex.test(email)) {
throw NOT_KOREA;
}
user.email = email;
user.receiveEmail = receiveEmail;
user.studentID = studentID;
Expand Down

0 comments on commit 558c43a

Please sign in to comment.