Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add repos when creating an insight page (#63)
- Loading branch information
1 parent
1b66716
commit 1f021a4
Showing
7 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
import { IsArray, IsString } from "class-validator"; | ||
|
||
export class CreateInsightDto { | ||
@ApiProperty({ | ||
description: "Insight Page Name", | ||
type: String, | ||
example: "My Team", | ||
}) | ||
@IsString() | ||
name: string; | ||
|
||
@ApiProperty({ | ||
description: "An array of repository IDs", | ||
type: [Number], | ||
isArray: true, | ||
example: [1, 2, 3], | ||
}) | ||
@IsArray() | ||
ids: number[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import { Repository } from "typeorm"; | ||
import { InjectRepository } from "@nestjs/typeorm"; | ||
|
||
import { DbInsightRepo } from "./entities/insight-repo.entity"; | ||
|
||
@Injectable() | ||
export class InsightRepoService { | ||
constructor ( | ||
@InjectRepository(DbInsightRepo) | ||
private insightRepoRepository: Repository<DbInsightRepo>, | ||
) {} | ||
|
||
async addInsightRepo (insightId: number, repoId: number) { | ||
const createdInsightRepo = this.insightRepoRepository.create({ insight_id: insightId, repo_id: repoId }); | ||
|
||
const newInsightRepo = await createdInsightRepo.save(); | ||
|
||
return newInsightRepo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters