bex-twn/src/resident/resident.seed.ts

56 lines
1.8 KiB
TypeScript

import { Injectable } from '@nestjs/common';
import { ResidentService } from './resident.service';
import { Command } from 'nestjs-command';
import {
TypeOfRegistration,
TypeOfRegistrationSub,
} from 'src/enums/type-of-registration.enums';
import { Industry } from 'src/enums/industry.enum';
import { RegulatoryElection } from 'src/enums/regulatory-election.enums';
import { ResidentStatus } from 'src/enums/status.enum';
@Injectable()
export class ResidentSeed {
constructor(private readonly residentService: ResidentService) {}
@Command({
command: 'create:resident',
describe: 'Create initial resident',
})
async create() {
const resident = await this.residentService.createResident({
sub: 'f26d49bd-73aa-4e9c-b793-a367e1315b7d',
firstName: 'Someone',
lastName: 'Special',
fullName: 'Someone Special',
permitNumber: 1234,
permitNumberQrCode: '<qr code in base 64>',
dateOfBirth: new Date('1998-12-13'),
countryOfBirth: 'Estonia',
email: 'someone.special@world-news.local',
citizenship: 'Estonia',
gender: 'm',
address: {
country: 'Estonia',
city: 'Tallinn',
streetAddress: '9 Lambi Tee',
zipCode: '34211',
isVerifiedAddress: true,
},
phoneNumber: '+372 5454 1010',
typeOfRegistration: TypeOfRegistration.E_RESIDENCY,
typeOfRegistrationSub: TypeOfRegistrationSub.INTERNATIONAL,
industry: Industry.WASTE_MANAGEMENT,
willWorkInPhysicalJurisdiction: false,
regulatoryElection: RegulatoryElection.ESTONIA,
regulatoryElectionSub: 'sub info',
firstRegistrationDate: new Date('2006-06-12'),
profilePicture: '<profile picture base64>',
status: ResidentStatus.ACTIVE,
nextSubscriptionPaymentDate: new Date(Date.now() + 31 * 24 * 60 * 60000),
});
console.log(resident);
}
}