updated graphql
This commit is contained in:
@@ -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> {
|
||||
|
||||
53
backend/src/people/queries.graphql
Normal file
53
backend/src/people/queries.graphql
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user