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

Construcción de querys #25

Closed
konami12 opened this issue Aug 29, 2018 · 1 comment
Closed

Construcción de querys #25

konami12 opened this issue Aug 29, 2018 · 1 comment
Assignees
Labels
🔨 Feature Una nueva caracteristica 🛠️ Refactor Refactorizacion de codigo ya existente
Milestone

Comments

@konami12
Copy link
Contributor

konami12 commented Aug 29, 2018

Los querys que se estarán ejecutando del lado de graphql necesitan una estructura base de la cual si lo vemos son muy genéricos por lo que seria recomendable crear un script que permite agilizar la estructuración de los querys.

Nota: Recordemos que estamos utilizando objection como ORM

Estructura de los querys.

// Comando que permite instertar un registro
Profesor.query().insert(args.profesor)

// Comando que permite actualizar un registro
Profesor.query().patchAndFetchById(args.profesorId, args.profesor)

// Comando que permite borrar un registro
 Profesor.query().findById(args.profesorId).then((profesor) => {
        return Profesor.query().deleteById(args.profesorId).then((filasBorradas) => {
          if (filasBorradas > 0) return profesor
          throw new Error(`El profesor con id ${args.profesorId} no se pudo eliminar`)
        })
      })
@konami12 konami12 added 🛠️ Refactor Refactorizacion de codigo ya existente 🔨 Feature Una nueva caracteristica labels Aug 29, 2018
@konami12 konami12 added this to the Mutaciones milestone Aug 29, 2018
@konami12 konami12 self-assigned this Aug 29, 2018
konami12 added a commit that referenced this issue Aug 29, 2018
Permite crear de manera agil los querys que se utilizaran.

issue #25
@konami12
Copy link
Contributor Author

Mutaciones creadas

This was referenced Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Feature Una nueva caracteristica 🛠️ Refactor Refactorizacion de codigo ya existente
Projects
None yet
Development

No branches or pull requests

1 participant