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 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'finance_tax_registrations', timestamps: true }) export class FinanceTaxRegistration extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) legalEntityId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) taxAuthorityName!: string; // e.g. "GST Department" @Prop({ required: true }) registrationNumber!: string; @Prop({ required: true }) stateCode!: string; // e.g. "MH", "KA" @Prop({ required: true }) countryCode!: string; // e.g. "IN" @Prop({ default: true }) isActive!: boolean; } export const FinanceTaxRegistrationSchema = SchemaFactory.createForClass(FinanceTaxRegistration); FinanceTaxRegistrationSchema.index({ tenantId: 1, legalEntityId: 1, registrationNumber: 1 }, { unique: true }); @Schema({ collection: 'tax_transactions', timestamps: true }) export class TaxTransaction extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) legalEntityId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) taxRegistrationId!: MongooseSchema.Types.ObjectId; @Prop({ required: true, enum: ['AP', 'AR', 'Manual'] }) documentType!: string; @Prop({ required: true }) documentId!: string; @Prop({ default: 0 }) taxableAmountMinor!: number; @Prop({ default: 0 }) taxAmountMinor!: number; @Prop({ required: true, default: 0.18 }) taxRateDecimal!: number; // e.g. 0.18 for 18% @Prop({ type: MongooseSchema.Types.Mixed }) taxDetails?: any; // e.g. { cgstMinor: 450, sgstMinor: 450 } } export const TaxTransactionSchema = SchemaFactory.createForClass(TaxTransaction); |