All files / src/database/seeds/mdm tax-masters.seed.ts

0% Statements 0/9
0% Branches 0/4
0% Functions 0/2
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86                                                                                                                                                                           
import { Injectable } from '@nestjs/common';
import { TaxMasterService } from '../../../domains/mdm/application/services/tax-master.service';
 
@Injectable()
export class TaxMastersSeed {
  constructor(private readonly taxService: TaxMasterService) {}
 
  async seed(): Promise<void> {
    // 1. Seed Tax Types
    await this.taxService.bulkUpsertTaxTypes([
      {
        taxTypeCode: 'GST',
        taxTypeName: 'Goods and Services Tax',
        taxCategory: 'indirect',
        countryCode: 'IN',
        taxClass: 'sales',
        active: true,
      },
      {
        taxTypeCode: 'VAT',
        taxTypeName: 'Value Added Tax',
        taxCategory: 'indirect',
        countryCode: 'DE',
        taxClass: 'sales',
        active: true,
      },
    ]);
 
    // 2. Seed Tax Codes
    await this.taxService.bulkUpsertTaxCodes([
      {
        taxCode: 'CGST',
        taxCodeName: 'Central Goods and Services Tax',
        taxTypeCode: 'GST',
        countryCode: 'IN',
        jurisdictionLevel: 'federal',
        active: true,
      },
      {
        taxCode: 'SGST',
        taxCodeName: 'State Goods and Services Tax',
        taxTypeCode: 'GST',
        countryCode: 'IN',
        jurisdictionLevel: 'state',
        active: true,
      },
      {
        taxCode: 'IGST',
        taxCodeName: 'Integrated Goods and Services Tax',
        taxTypeCode: 'GST',
        countryCode: 'IN',
        jurisdictionLevel: 'federal',
        active: true,
      },
    ]);
 
    // 3. Seed Tax Rates
    await this.taxService.bulkUpsertTaxRates([
      {
        taxCode: 'CGST',
        countryCode: 'IN',
        rateName: 'CGST @ 9%',
        rate: '9.00',
        effectiveFrom: new Date('2026-01-01'),
        status: 'active',
      },
      {
        taxCode: 'SGST',
        countryCode: 'IN',
        rateName: 'SGST @ 9%',
        rate: '9.00',
        effectiveFrom: new Date('2026-01-01'),
        status: 'active',
      },
      {
        taxCode: 'IGST',
        countryCode: 'IN',
        rateName: 'IGST @ 18%',
        rate: '18.00',
        effectiveFrom: new Date('2026-01-01'),
        status: 'active',
      },
    ]);
  }
}