| Total Complexity | 2 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Injectable } from '@nestjs/common'; |
||
| 6 | |||
| 7 | @Injectable() |
||
| 8 | export class ShippingCostRepository implements IShippingCostRepository { |
||
| 9 | constructor( |
||
| 10 | @InjectRepository(ShippingCost) |
||
| 11 | private readonly repository: Repository<ShippingCost> |
||
| 12 | ) {} |
||
| 13 | |||
| 14 | public save(shippingCost: ShippingCost): Promise<ShippingCost> { |
||
| 15 | return this.repository.save(shippingCost); |
||
| 16 | } |
||
| 17 | |||
| 18 | public findOneByGrams(grams: number): Promise<ShippingCost | undefined> { |
||
| 19 | return this.repository |
||
| 20 | .createQueryBuilder('shippingCost') |
||
| 21 | .select([ 'shippingCost.id' ]) |
||
| 22 | .where('shippingCost.grams = :grams', { grams }) |
||
| 23 | .getOne(); |
||
| 26 |