Skip to content
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

Closed
wants to merge 29 commits into from
Closed

Lor 214 list user #46

wants to merge 29 commits into from

Conversation

Daaaiii
Copy link
Member

@Daaaiii Daaaiii commented Feb 7, 2024

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"
} ] } }}}

prisma/schema.prisma Outdated Show resolved Hide resolved
prisma/schema.prisma Outdated Show resolved Hide resolved
src/decorators/account.decorator.ts Outdated Show resolved Hide resolved
src/modules/account/account.repository.ts Outdated Show resolved Hide resolved
src/modules/account/account.repository.ts Outdated Show resolved Hide resolved
src/modules/account/account.repository.ts Outdated Show resolved Hide resolved
src/modules/account/account.service.ts Outdated Show resolved Hide resolved
Comment on lines 36 to 37
export type GetCredential = Pick<Credential, 'id' | 'email'> & {
parentProfile: Pick<ParentProfile, 'id' | 'fullname'> & {
Copy link
Contributor

@viniciuscosmome viniciuscosmome Feb 20, 2024

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

Suggested change
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({
Copy link
Contributor

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.

Suggested change
.findFirst({
.findUnique({

Comment on lines 87 to 99
select: {
id: true,
email: true,
parentProfile: {
select: {
id: true,
fullname: true,
childrens: {
select: {
id: true,
fullname: true,
gender: true,
birthdate: true,
Copy link
Contributor

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

@viniciuscosmome
Copy link
Contributor

viniciuscosmome commented Mar 13, 2024

requisitos de aceite

Adicionar um ponto de acesso para ler todas as informações do usuário

  • somente usuário autenticado
  • somente informações necessárias devem ser retornadas
    • e-mail do responsável;
    • nome completo, responsável;
    • lista de todas crianças vinculadas a este perfil:
      • ID da conta;
      • nome completo;
      • sexo;
      • aniversário;

@Daaaiii Daaaiii closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants