Skip to content

Commit

Permalink
Fix study logic for pending issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yesjjin99 committed Jun 12, 2022
1 parent ae2b38a commit 6b4d66c
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 183 deletions.
2 changes: 1 addition & 1 deletion src/entity/NoticeEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Notice {
@PrimaryGeneratedColumn('uuid', { name: 'ID' })
id!: string;

@Column('varchar', { name: 'TITLE', length: 500 })
@Column('varchar', { name: 'TITLE', length: 40 })
title!: string;

@Column('varchar', { name: 'ABOUT', length: 500 })
Expand Down
2 changes: 1 addition & 1 deletion src/entity/StudyEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class Study {
@CreateDateColumn({ name: 'CREATED_AT' })
createdAt!: Date;

@Column('varchar', { name: 'TITLE', length: 500 })
@Column('varchar', { name: 'TITLE', length: 40 })
title!: string;

@Column('varchar', { name: 'STUDY_ABOUT', length: 500 })
Expand Down
7 changes: 3 additions & 4 deletions src/routes/notice/notice.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
createNotice,
deleteNotice,
findAllNotice,
findAllUser,
findNoticeById,
findNoticeCount,
updateNoticeById,
Expand All @@ -12,7 +11,7 @@ import {
import { UserRoleEnum } from '../../entity/UserEntity';
import { createNoticeNoti, NotiTypeEnum } from '../../services/notification';
import { temp_findUserProfileById } from '../../services/user/profile';
import { findOnlyUserRoleById } from '../../services/user';
import { findAllUser, findOnlyUserRoleById } from '../../services/user';

export default {
async findAllNotice(req: Request, res: Response) {
Expand Down Expand Up @@ -90,10 +89,10 @@ export default {
if (process.env.NODE_ENV !== 'test') {
const users = await findAllUser();
if (users.length !== 0) {
for (const u of users) {
for (const user of users) {
await createNoticeNoti({
id,
userId: u.id,
userId: user.id,
title: '새로운 공지',
about: '중대본으로부터 새로운 공지글이 등록되었어요.',
type: NotiTypeEnum.NEW_NOTICE,
Expand Down
6 changes: 5 additions & 1 deletion src/routes/study/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ router.get('/', controller.getAllStudy);
router.post('/', checkToken, controller.createStudy);

router.get('/search', controller.searchStudy);
router.get('/:studyid', controller.getStudybyId);
router.get(
'/:studyid',
controller.getStudybyIdWithLogIn,
controller.getStudybyId
);
router.patch('/:studyid', checkToken, controller.updateStudy);
router.delete('/:studyid', checkToken, controller.deleteStudy);

Expand Down
Loading

0 comments on commit 6b4d66c

Please sign in to comment.