Skip to content

Commit

Permalink
Merge pull request #75 from Fam-Story/fix/74-post-api
Browse files Browse the repository at this point in the history
Fix: Post API 및 PUT 메소드 오류 수정
  • Loading branch information
synoti21 authored Dec 5, 2023
2 parents 6a4b67b + 58a01df commit a9669a6
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/domain/family/dto/request/update-family.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export class UpdateFamilyDto extends PartialType(CreateFamilyDto) {
@ApiProperty({ example: 1, description: '가족 ID', nullable: false })
@IsNotEmpty()
@IsNumber()
familyId: number;
id: number;
}
2 changes: 1 addition & 1 deletion src/domain/family/family.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class FamilyService {

//가족 정보 업데이트
async updateFamily(updateFamilyDto: UpdateFamilyDto): Promise<void> {
const family = await this.validateFamily(updateFamilyDto.familyId);
const family = await this.validateFamily(updateFamilyDto.id);
await this.familyRepository.update(
{ id: family.id },
{ ...updateFamilyDto },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export class UpdateFamilyMemberDto extends PartialType(CreateFamilyMemberDto) {
})
@IsNotEmpty()
@IsNumber()
readonly familyMemberId: number;
readonly id: number;
}
2 changes: 1 addition & 1 deletion src/domain/family_member/family-member.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class FamilyMemberService {
updateFamilyMemberDto: UpdateFamilyMemberDto,
): Promise<void> {
const familyMember = await this.validateFamilyMember(
updateFamilyMemberDto.familyMemberId,
updateFamilyMemberDto.id,
);
await this.familyMemberRepository.update(
{ id: familyMember.id },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export class UpdateFamilyScheduleDto extends PartialType(
})
@IsNotEmpty()
@IsNumber()
readonly familyScheduleId: number;
readonly id: number;
}
2 changes: 1 addition & 1 deletion src/domain/family_schedule/family-schedule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class FamilyScheduleService {

async updateFamilySchedule(updateFamilyScheduleDto: UpdateFamilyScheduleDto) {
const familySchedule = await this.validateFamilySchedule(
updateFamilyScheduleDto.familyScheduleId,
updateFamilyScheduleDto.id,
);
await this.validateFamily(updateFamilyScheduleDto.familyId);
await this.familyScheduleRepository.update(
Expand Down
2 changes: 1 addition & 1 deletion src/domain/post/dto/request/update-post.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export class UpdatePostDto extends PartialType(CreatePostDto) {
@ApiProperty({ example: 1, description: '포스트의 고유 ID' })
@IsNotEmpty()
@IsNumber()
postId: number;
id: number;
}
2 changes: 1 addition & 1 deletion src/domain/post/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class PostService {
}

async updatePost(updatePostDto: UpdatePostDto) {
const post = await this.validatePost(updatePostDto.postId);
const post = await this.validatePost(updatePostDto.id);
await this.validateFamilyMember(updatePostDto.srcMemberId);

await this.postRepository.update({ id: post.id }, { ...updatePostDto });
Expand Down
2 changes: 1 addition & 1 deletion src/infra/entities/post.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Post {
@Column('varchar', { name: 'Context', length: 50 })
context: string;

@Column('date', { name: 'Created_Date' })
@Column('datetime', { name: 'Created_Date' })
createdDate: Date;

@ManyToOne(() => FamilyMember, (familyMember) => familyMember.sentPosts, {
Expand Down
2 changes: 1 addition & 1 deletion src/test/service/family-member.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('FamilyMemberService', () => {
it('should update family-member', async () => {
const updateFamilyMemberDto: UpdateFamilyMemberDto = {
role: 1,
familyMemberId: 1,
id: 1,
};
const family: Family = Family.createFamily('test', 'testKeyCode');
const user: User = User.createUser('test', 'test', 'test', 'test', 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/test/service/family-schedule.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('FamilyScheduleService', () => {
);
familySchedule.setId(1);
const updateFamilyScheduleDto = {
familyScheduleId: 1,
id: 1,
scheduleName: 'testSchedule',
scheduleYear: 2021,
scheduleMonth: 10,
Expand Down
2 changes: 1 addition & 1 deletion src/test/service/family.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('FamilyService', () => {
//given
const familyKeyCode = familyService.createFamilyKeyCode();
const updateFamilyDto: UpdateFamilyDto = {
familyId: 1,
id: 1,
familyName: 'testUpdated',
};
const family = Family.createFamily('test', familyKeyCode);
Expand Down
2 changes: 1 addition & 1 deletion src/test/service/post.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('PostService', () => {
post.id = 1;

const updatePostDto: UpdatePostDto = {
postId: 1,
id: 1,
title: 'test',
context: 'test',
srcMemberId: 1,
Expand Down

0 comments on commit a9669a6

Please sign in to comment.