From fc5d443feb681c6f25636c67750bf2ffde1460d2 Mon Sep 17 00:00:00 2001 From: Janderson Souza Matias Date: Wed, 22 Nov 2023 10:45:16 -0300 Subject: [PATCH] adjust sync service --- src/modules/sync/controller/types.ts | 1 + src/modules/sync/service/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/sync/controller/types.ts b/src/modules/sync/controller/types.ts index 711d15e..16c7dbe 100644 --- a/src/modules/sync/controller/types.ts +++ b/src/modules/sync/controller/types.ts @@ -30,6 +30,7 @@ export type DataToSync = { export type SyncData = { coaches: Coach[]; + competencies: Competence[]; coachSchools: CoachSchool[]; sessions: Session[]; questions: Question[]; diff --git a/src/modules/sync/service/index.ts b/src/modules/sync/service/index.ts index 590befe..f249624 100644 --- a/src/modules/sync/service/index.ts +++ b/src/modules/sync/service/index.ts @@ -11,6 +11,8 @@ import { Sync } from "../entity"; import { School } from "../../school/entity/school.entity"; import { Question } from "../../question/entity/question.entity"; import { CoachSchool } from "../../coach/entity/coach-school.entity"; +import { CompetenceService } from "../../competencies/service"; +import { QuestionService } from "../../question/service"; export class SyncService { static findAll = async (): Promise => { @@ -40,15 +42,17 @@ export class SyncService { await this.saveSyncByEntity(Answer, changes.answers || []); await this.saveSyncByEntity(Feedback, changes.feedbacks || []); - const questions = await this.getDataToSync(Question, lastSync); const { coaches, coachSchools } = await this.getCoachDataToSync(school); const teachers = await this.getDataToSync(Teacher, undefined, school); const sessions = await this.getDataToSync(Session, lastSync, school); const answers = await this.getAnswerToSync(sessions); const feedbacks = await this.getFeedbackToSync(school, lastSync); + const competencies = await CompetenceService.findAll(); + const questions = await QuestionService.findAll(); return { coaches, + competencies, coachSchools, feedbacks, questions,