Skip to content

Instantly share code, notes, and snippets.

@endurance
Created March 28, 2020 19:14
Show Gist options
  • Save endurance/e356c08af649b4f878ed42f2f7ec9991 to your computer and use it in GitHub Desktop.
Save endurance/e356c08af649b4f878ed42f2f7ec9991 to your computer and use it in GitHub Desktop.
import { Args, Field, ID, Mutation, ObjectType, Resolver } from '@nestjs/graphql';
import { BasinJobService } from '../../general/services/job/basin-job.service';
@ObjectType()
class DeleteBasinForJobInput {
@Field(_ => ID)
public jobId: string;
@Field(_ => [String])
public basinNames: string[];
}
@ObjectType()
class InsertBasinForJobInput {
@Field(_ => ID)
public jobId: string;
@Field(_ => [String])
public basinNames: string[];
}
@Resolver()
export class BasinJobResolver {
constructor(
private readonly _basinForJobService: BasinJobService,
) {}
@Mutation(_ => ID, {name: 'deleteBasinForJob'})
public async deleteBasinForJob(
@Args('jobData') data: DeleteBasinForJobInput,
) {
return await this._basinForJobService.deleteBasinInJobByNames(data.jobId, data.basinNames);
}
@Mutation(_ => ID, {name: 'insertBasinForJob'})
public async insertBasinForJob(
@Args('jobData') data: InsertBasinForJobInput,
) {
return await this._basinForJobService.insertBasinForJobByNames(data.jobId, data.basinNames);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment