-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description * Create service * Delete service ## Checklist - [x] This PR can be reviewed in under 30 minutes - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have assigned reviewers to this PR.
- Loading branch information
Showing
5 changed files
with
57 additions
and
1 deletion.
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,17 @@ | ||
import { Injectable, PipeTransform } from '@nestjs/common'; | ||
import { DampLabServicePipe } from '../services/damplab-services.pipe'; | ||
import { CreateService } from './dtos/create.dto'; | ||
|
||
@Injectable() | ||
export class CreateServicePipe implements PipeTransform<CreateService, Promise<CreateService>> { | ||
constructor(private readonly damplabServicePipe: DampLabServicePipe) {} | ||
|
||
async transform(value: CreateService): Promise<CreateService> { | ||
// Ensure the services are valid | ||
for (const service of value.allowedConnections) { | ||
await this.damplabServicePipe.transform(service); | ||
} | ||
|
||
return value; | ||
} | ||
} |
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
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,8 @@ | ||
import { ID, InputType, Field, OmitType } from '@nestjs/graphql'; | ||
import { DampLabService } from '../models/damplab-service.model'; | ||
|
||
@InputType() | ||
export class CreateService extends OmitType(DampLabService, ['_id', 'allowedConnections'] as const, InputType) { | ||
@Field(() => [ID]) | ||
allowedConnections: string[]; | ||
} |