Skip to content

Commit

Permalink
Merge pull request #87 from Fam-Story/feat/86-intro-message
Browse files Browse the repository at this point in the history
Feat: 가족 멤버 상태 메시지 추가
  • Loading branch information
synoti21 authored Dec 9, 2023
2 parents c717cdb + f4d87d0 commit 289a31a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/domain/family_member/dto/request/create-family-member.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ export class CreateFamilyMemberDto {

@ApiProperty({
example: 1,
description: '가족 멤버의 FCM 토큰',
nullable: false,
})
@IsNotEmpty()
@IsString()
readonly fcmToken: string;

@ApiProperty({
example: '안녕안녕',
description: '가족 멤버의 상태 메시지',
nullable: true,
})
@IsString()
readonly introMessage: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export class ResponseFamilyMemberDto {
})
readonly role: number;

@ApiProperty({
example: '졸려',
description: '가족 멤버의 상태 메시지',
})
readonly introMessage: string;

@ApiProperty({ example: 1, description: '가족 멤버의 총 찌르기 횟수' })
readonly pokeCount: number;

Expand All @@ -28,23 +34,25 @@ export class ResponseFamilyMemberDto {
name: string,
nickname: string,
role: number,
introMessage: string,
pokeCount: number,
talkCount: number,
) {
this.familyMemberId = familyMemberId;
this.name = name;
this.nickname = nickname;
this.role = role;
this.introMessage = introMessage;
this.pokeCount = pokeCount;
this.talkCount = talkCount;
}

static of(
familyMemberId: number,
familyId: number,
name: string,
nickname: string,
role: number,
introMessage: string,
pokeCount: number,
talkCount: number,
): ResponseFamilyMemberDto {
Expand All @@ -53,6 +61,7 @@ export class ResponseFamilyMemberDto {
name,
nickname,
role,
introMessage,
pokeCount,
talkCount,
);
Expand All @@ -64,6 +73,7 @@ export class ResponseFamilyMemberDto {
familyMember.user.username,
familyMember.user.nickname,
familyMember.role,
familyMember.introMessage,
familyMember.pokeCount,
familyMember.talkCount,
);
Expand Down
3 changes: 3 additions & 0 deletions src/infra/entities/family-member.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class FamilyMember {
@Column('varchar', { name: 'Fcm_Token', length: 255 })
fcmToken: string;

@Column('varchar', { name: 'Intro_Message', length: 50 })
introMessage: string;

@ManyToOne(() => Family, (family) => family.familyMembers, {
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
Expand Down
1 change: 1 addition & 0 deletions src/test/service/family-member.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('FamilyMemberService', () => {
role: 1,
familyId: 1,
fcmToken: 'test',
introMessage: 'test',
};
const family: Family = Family.createFamily('test', 'testKeyCode');
const user: User = User.createUser('test', 'test', 'test', 'test', 1, 1);
Expand Down

0 comments on commit 289a31a

Please sign in to comment.