updated graphql

This commit is contained in:
2025-11-14 22:30:33 +03:00
parent 2e329d8dfe
commit a67170daa8
8 changed files with 130 additions and 29 deletions

View File

@@ -12,11 +12,11 @@ export class PeopleService {
) { }
async findAll(projection?: any): Promise<PersonDocument[]> {
return this.personModel.find({}, projection, { lean: false }).populate({ path: 'person', select: projection?.person }).exec();
return this.personModel.find({}, projection, { lean: false }).exec();
}
async findById(id: Types.ObjectId, projection?: any): Promise<PersonDocument | null> {
return this.personModel.findById(id, projection, { lean: false }).populate({ path: 'person', select: projection?.person }).exec();
return this.personModel.findById(id, projection, { lean: false }).exec();
}
async create(input: CreatePersonInput): Promise<PersonDocument> {

View File

@@ -0,0 +1,53 @@
mutation CreatePerson {
createPerson(input: {
firstName: "John",
surname: "Doe",
middleName: "Michael",
sexCode: "M",
personRef: "REF12345",
personTag: "TAG001",
fatherName: "Robert",
motherName: "Jane",
countryCode: "US",
nationalIdentityId: "12345678901",
birthPlace: "New York",
birthDate: "1990-01-01T00:00:00.000Z",
taxNo: "987654321",
birthname: "Johnathan"
}) {
_id
firstName
surname
birthDate
}
}
query GetPerson {
Person(id: "69175eec7baea04628ad126c") {
_id
firstName
surname
middleName
sexCode
birthDate
}
}
query {
Persons {
firstName
surname
middleName
sexCode
personRef
personTag
fatherName
motherName
countryCode
nationalIdentityId
birthPlace
birthDate
taxNo
birthname
}
}