-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lor 214 list user #46
Conversation
Co-authored-by: Cosmo <[email protected]>
Co-authored-by: Cosmo <[email protected]>
Co-authored-by: Cosmo <[email protected]>
Co-authored-by: Cosmo <[email protected]>
Co-authored-by: Cosmo <[email protected]>
export type GetCredential = Pick<Credential, 'id' | 'email'> & { | ||
parentProfile: Pick<ParentProfile, 'id' | 'fullname'> & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não retornar id da credencial, nem do responsável. esse id é obtido pela chave de acesso
export type GetCredential = Pick<Credential, 'id' | 'email'> & { | |
parentProfile: Pick<ParentProfile, 'id' | 'fullname'> & { | |
export type GetCredential = Pick<Credential, 'email'> & { | |
parentProfile: Pick<ParentProfile, 'fullname'> & { |
@@ -81,6 +80,37 @@ export class AccountRepository { | |||
return response; | |||
} | |||
|
|||
async getCredentialId(id: string): Promise<GetCredential | void> { | |||
const response = await this.prisma.credential | |||
.findFirst({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O método findFirst
passa por todos os dados da tabela para buscar o primeiro que aparece, já o findUnique
usa o índice criado por ser um dado único.
.findFirst({ | |
.findUnique({ |
select: { | ||
id: true, | ||
email: true, | ||
parentProfile: { | ||
select: { | ||
id: true, | ||
fullname: true, | ||
childrens: { | ||
select: { | ||
id: true, | ||
fullname: true, | ||
gender: true, | ||
birthdate: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remover id da credencial, id do responsável
requisitos de aceiteAdicionar um ponto de acesso para ler todas as informações do usuário
|
Add endpoint GET account to list parent and childrens data.
Output will be like this:
{
"message": "Dados recebidos com sucesso",
"data": {
"credential": {
"id": "3",
"email": "09e5c489a25959dfea369ac0b98976f074cff9baae99e0ffa34c442c713c6b91",
"parentProfile": {
"id": "2a531e67-2a99-4c38-a873-fb434fbe9d43",
"fullname": "Daiane Bolzan",
"childrens": [
{
"id": 2,
"fullname": "Joana Bolzan",
"gender": "female",
"birthdate": "2000-09-09T00:00:00.000Z"
} ] } }}}