Skip to content

Commit

Permalink
fix: use save operation directly for insights, insight repos (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Nov 18, 2022
1 parent a0ebbd6 commit bd25889
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/insight/insight-repo.service.ts
Expand Up @@ -12,10 +12,6 @@ export class InsightRepoService {
) {}

async addInsightRepo (insightId: number, repoId: number) {
const createdInsightRepo = this.insightRepoRepository.create({ insight_id: insightId, repo_id: repoId });

const newInsightRepo = await createdInsightRepo.save();

return newInsightRepo;
return this.insightRepoRepository.save({ insight_id: insightId, repo_id: repoId });
}
}
6 changes: 1 addition & 5 deletions src/insight/insights.service.ts
Expand Up @@ -37,11 +37,7 @@ export class InsightsService {
}

async addInsight (insight: Partial<DbInsight>) {
const createdInsight = this.insightRepository.create({ ...insight });

const newInsight = await createdInsight.save();

return newInsight;
return this.insightRepository.save(insight);
}

async findAllByUserId (
Expand Down

0 comments on commit bd25889

Please sign in to comment.