diff --git a/repositories/FeedbackRepository.ts b/repositories/FeedbackRepository.ts index fbaa8fe8..aa6250d4 100644 --- a/repositories/FeedbackRepository.ts +++ b/repositories/FeedbackRepository.ts @@ -15,8 +15,16 @@ export class FeedbackRepository extends BaseRepository { return this.getBaseFindQuery({}).where({ uuid }).getOne(); } - public async getAllFeedbackForUser(user: UserModel): Promise { - return this.getBaseFindQuery({}).where({ user }).getMany(); + // temporary fix for getting feedback for a user for an event + public async getStandardUserFeedback(user: UserModel, options: FeedbackSearchOptions): Promise { + let query = this.getBaseFindQuery(options); + query = query.andWhere('feedback.user = :user', { user: user.uuid }); + + return query.getMany(); + } + + public async getAllFeedbackForUser(user: UserModel, options: FeedbackSearchOptions): Promise { + return this.getBaseFindQuery(options).where({ user }).getMany(); } public async upsertFeedback(feedback: FeedbackModel, diff --git a/services/FeedbackService.ts b/services/FeedbackService.ts index 12e23654..f8d5f059 100644 --- a/services/FeedbackService.ts +++ b/services/FeedbackService.ts @@ -25,7 +25,7 @@ export default class FeedbackService { .map((fb) => fb.getPublicFeedback()); } - const userFeedback = await feedbackRepository.getAllFeedbackForUser(user); + const userFeedback = await feedbackRepository.getStandardUserFeedback(user, options); return userFeedback.map((fb) => fb.getPublicFeedback()); }); } diff --git a/tests/feedback.test.ts b/tests/feedback.test.ts index 2c826eed..f2516307 100644 --- a/tests/feedback.test.ts +++ b/tests/feedback.test.ts @@ -164,7 +164,7 @@ describe('feedback submission', () => { const feedbackController = ControllerFactory.feedback(conn); await feedbackController.submitFeedback(buildFeedbackRequest(feedback1), member1); await feedbackController.submitFeedback(buildFeedbackRequest(feedback2), member2); - const user1Feedback = await feedbackController.getFeedback({}, member1); + const user1Feedback = await feedbackController.getFeedback({ user: member1.uuid }, member1); expect(user1Feedback.feedback).toHaveLength(1);