-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tax resolver added * displayName is a field * correctly build and push the current commit * fix where for documentnumbersequence * formatted * add optimize imports * imports organized * prettier in the client * fix the sales invoice duplication * formatted --------- Co-authored-by: David Podhola <[email protected]>
- Loading branch information
1 parent
dd70b5d
commit 18386d1
Showing
7 changed files
with
68 additions
and
4 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
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,36 @@ | ||
import { Inject, UseGuards } from '@nestjs/common'; | ||
import { Args, Int, Mutation, Query, Resolver } from '@nestjs/graphql'; | ||
import { InjectEntityManager } from '@nestjs/typeorm'; | ||
import { EntityManager } from 'typeorm'; | ||
import { CurrentUser, GqlAuthGuard } from '../../auth'; | ||
import { TaxModel, TaxService, TaxServiceKey } from '../../model'; | ||
import { Tax } from '../../model/generated/entities/Tax'; | ||
import { TaxSaveArgs } from '../saveArgs/tax.save.args'; | ||
|
||
@Resolver(() => Tax) | ||
@UseGuards(GqlAuthGuard) | ||
export class TaxResolver { | ||
constructor( | ||
@Inject(TaxServiceKey) protected readonly taxService: TaxService, | ||
@InjectEntityManager() | ||
private readonly entityManager: EntityManager, | ||
) {} | ||
|
||
@Query(() => [Tax]) | ||
async taxes() { | ||
return await this.taxService.loadEntities(this.entityManager); | ||
} | ||
|
||
@Query(() => Tax) | ||
async tax(@Args('id', { type: () => Int }) id: number) { | ||
return await this.taxService.loadEntityById(this.entityManager, id); | ||
} | ||
|
||
@Mutation(() => Tax) | ||
async saveTax( | ||
@Args('args') objData: TaxSaveArgs, | ||
@CurrentUser() user, | ||
): Promise<TaxModel> { | ||
return await this.taxService.save(this.entityManager, objData, user); | ||
} | ||
} |
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,13 @@ | ||
import { Field, InputType } from '@nestjs/graphql'; | ||
import { TaxSaveArgsModel } from '../../model'; | ||
import { BaseSaveArgs } from './base.save.args'; | ||
|
||
@InputType() | ||
export class TaxSaveArgs extends BaseSaveArgs implements TaxSaveArgsModel { | ||
@Field() | ||
displayName: string; | ||
@Field() | ||
ratePercent: number; | ||
@Field() | ||
isStandard: boolean; | ||
} |
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 @@ | ||
git push dokku HEAD:main --force |