Skip to content

Commit

Permalink
Merge pull request #94 from Fam-Story/feat/92-interaction-response
Browse files Browse the repository at this point in the history
fix: introMessage query error 수정 (#92)
  • Loading branch information
synoti21 authored Dec 11, 2023
2 parents 6237b68 + edbfc3d commit 80e839e
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 28 deletions.
23 changes: 12 additions & 11 deletions src/common/util/fcm-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import { InteractionException } from '../exception/interaction.exception';
import { ResponseCode } from '../api';

const firebase_params = {
type: process.env.FIREBASE_TYPE,
projectId: process.env.PROJECT_ID,
privateKeyId: process.env.PRIVATE_KEY_ID,
privateKey: process.env.PRIVATE_KEY,
clientEmail: process.env.CLIENT_EMAIL,
clientId: process.env.CLIENT_ID,
authUri: process.env.AUTH_URI,
tokenUri: process.env.TOKEN_URI,
authProviderX509CertUrl: process.env.AUTH_PROVIDER,
clientC509CertUrl: process.env.CLIENT_CERT,
universe_domain: process.env.UNIVERSE_DOMAIN,
type: 'process.env.FIREBASE_TYPE',
projectId: ' process.env.PROJECT_ID',
privateKeyId: 'process.env.PRIVATE_KEY_ID',
privateKey:
'-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCdQiE6AJFV238E\nJ67sgP3BsBXJQHtn3MvG8KK3C0A2AxXsb3r6vEwpgINIGeW20eaxN8Suikvw7gV7\nfOTAhpJlod1pEa+OwX9SCjADgPA+xej6GiDEJE5I3xqHw42bwiUD2ZMSQvjAFtRj\nKFgZwSz/DXyo9iEYrjOF+2WZKnvxcgooMF151qqrMjhnRUJ17VdkQpgjPktbOD9N\nIVselesF6HcHyNXWpNw922RQlhOGDkq+3mlIDSbCVHOeYEyVhR1uwMV4cqm5jmoa\nmIswKyDdbV4NrjWIWFiN8sq4yYrZBBufATNIURxOUZkmhlQlC+3ybnU+unJEAinf\nrH5PTXsnAgMBAAECggEAJRYE3vhmTfCrNjAjn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XN8d6KlWlPsH9HV\nD6QiUdUsn+zvwL1VDi20OyNdJ7dw3BktMd58xtNOdNJ69j1aVqshQhwi6hinJlVz\npkG9UNQTQnHP4iwCaRsZnXWQJuT5N5/NLAEah19qcE9SUsTrAhqOmhRjSi6duWAH\nNNtvfc2PzGl7k8J5BZ0amQ==\n-----END PRIVATE KEY-----\n',
clientEmail: 'process.env.CLIENT_EMAIL',
clientId: 'process.env.CLIENT_ID',
authUri: 'process.env.AUTH_URI',
tokenUri: 'process.env.TOKEN_URI,',
authProviderX509CertUrl: ' process.env.AUTH_PROVIDER',
clientC509CertUrl: 'process.env.CLIENT_CERT',
universe_domain: 'process.env.UNIVERSE_DOMAIN',
};

@Injectable()
Expand Down
1 change: 1 addition & 0 deletions src/domain/family_member/family-member.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class FamilyMemberService {
family,
user,
createFamilyMemberDto.fcmToken,
createFamilyMemberDto.introMessage,
);
const savedMember = await this.familyMemberRepository.save(familyMember);
family.memberNumber += 1;
Expand Down
2 changes: 2 additions & 0 deletions src/infra/entities/family-member.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class FamilyMember {
family: Family,
user: User,
fcmToken: string,
introMessage: string,
): FamilyMember {
const familyMember = new FamilyMember();
familyMember.role = role;
Expand All @@ -68,6 +69,7 @@ export class FamilyMember {
familyMember.family = family;
familyMember.user = user;
familyMember.fcmToken = fcmToken;
familyMember.introMessage = introMessage;
return familyMember;
}

Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/chat.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('ChatController (e2e)', () => {
family,
user,
null,
null,
);
const chat: ChatMessage = ChatMessage.createMessage(
'testContent',
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/family-member.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('FamilyMemberController (e2e)', () => {
mockFamily,
mockUser,
'test',
'test'
);
mockFamilyMember.setId(1);

Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/family.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('FamilyController (e2e)', () => {
mockFamily,
mockUser,
'test',
'test',
);
beforeEach(async () => {
mockFamilyService = {
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/post.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('PostController (e2e)', () => {
'testTitle',
'testContext',
new Date(),
FamilyMember.createFamilyMember(1, null, null, ''),
FamilyMember.createFamilyMember(1, null, null, '', ''),
Family.createFamily('test', 'test'),
);

Expand Down
4 changes: 2 additions & 2 deletions src/test/service/chat.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('ChatService', () => {
role: '1',
};
const family = Family.createFamily('test', 'test');
const familyMember = FamilyMember.createFamilyMember(1, family, null, null);
const familyMember = FamilyMember.createFamilyMember(1, family, null, null, null);

const date = new Date();
jest
Expand All @@ -65,7 +65,7 @@ describe('ChatService', () => {
const userId = 1;
const user = User.createUser('test', 'test', 'test', 'testNickname', 1, 1);
const family = Family.createFamily('test', 'test');
const familyMember = FamilyMember.createFamilyMember(1, family, user, null);
const familyMember = FamilyMember.createFamilyMember(1, family, user, null, null);
const chatMessage = ChatMessage.createMessage(
'hello',
new Date(11, 11, 11, 11, 11, 11),
Expand Down
13 changes: 7 additions & 6 deletions src/test/service/family-member.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe('FamilyMemberService', () => {
family,
user,
createFamilyMemberDto.fcmToken,
createFamilyMemberDto.introMessage,
);
user.id = 1;
familyMember.setId(1);
Expand All @@ -87,7 +88,7 @@ describe('FamilyMemberService', () => {
};
const family: Family = Family.createFamily('test', 'testKeyCode');
const user: User = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
user.id = 1;
familyMember.setId(1);

Expand All @@ -105,7 +106,7 @@ describe('FamilyMemberService', () => {
it('should delete family-member', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
familyMember.setId(1);

jest
Expand All @@ -122,7 +123,7 @@ describe('FamilyMemberService', () => {
it('should find family-member by user id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
familyMember.setId(1);

jest.spyOn(userRepository, 'findOne').mockResolvedValue(user);
Expand All @@ -137,7 +138,7 @@ describe('FamilyMemberService', () => {
it('should find family by family-member id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
const getFamilyInfoDto: GetFamilyInfoDto = {
familyMemberId: 1,
fcmToken: 'test',
Expand All @@ -159,7 +160,7 @@ describe('FamilyMemberService', () => {
it('should find all family-member by family id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
familyMember.setId(10);
family.setId(1);

Expand All @@ -175,7 +176,7 @@ describe('FamilyMemberService', () => {
it('should find family-member by family-member id', async () => {
const family: Family = Family.createFamily('test', 'testKeyCode');
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
familyMember.setId(1);

jest
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 @@ -102,7 +102,7 @@ describe('FamilyService', () => {
familyKeyCode,
);
const user = User.createUser('test', 'test', 'test', 'test', 1, 1);
const familyMember = FamilyMember.createFamilyMember(1, family, user, '');
const familyMember = FamilyMember.createFamilyMember(1, family, user, '', '');
familyMember.setId(1);
family.setId(1);
user.setId(1);
Expand Down
7 changes: 4 additions & 3 deletions src/test/service/interaction.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('InteractionService', () => {
family,
user,
'',
''
);
dstFamilyMember.fcmToken = 'test';
dstFamilyMember.setId(3);
Expand Down Expand Up @@ -89,7 +90,7 @@ describe('InteractionService', () => {
it('should find all interactions', async () => {
//given
const familyMemberId = 1;
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '');
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
dstFamilyMember.setId(2);
const interaction = Interaction.createInteraction(
1,
Expand Down Expand Up @@ -117,7 +118,7 @@ describe('InteractionService', () => {
it('should check all interactions', async () => {
//given
const familyMemberId = 1;
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '');
const dstFamilyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
const interaction = Interaction.createInteraction(
1,
dstFamilyMember,
Expand All @@ -142,7 +143,7 @@ describe('InteractionService', () => {
//given
const interactionId = 1;
const interaction = Interaction.createInteraction(1, null, 2, '', 1);
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '', '');

jest.spyOn(interactionRepository, 'findOne').mockResolvedValue(interaction);
jest.spyOn(interactionRepository, 'delete').mockResolvedValue(null);
Expand Down
8 changes: 4 additions & 4 deletions src/test/service/post.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('PostService', () => {

it('should create post', async () => {
const family = Family.createFamily('test', 'test');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
const post = Post.createPost(
'test',
'test',
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('PostService', () => {

it('should update post', async () => {
const family = Family.createFamily('test', 'test');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
const post = Post.createPost(
'test',
'test',
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('PostService', () => {
});

it('should delete post', async () => {
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
const post = Post.createPost(
'test',
'test',
Expand All @@ -137,7 +137,7 @@ describe('PostService', () => {

it('should get post list', async () => {
const family = Family.createFamily('test', 'test');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '');
const familyMember = FamilyMember.createFamilyMember(1, null, null, '', '');
familyMember.id = 1;
const post = Post.createPost(
'test',
Expand Down

0 comments on commit 80e839e

Please sign in to comment.