-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
7,569 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": true | ||
} | ||
} | ||
] | ||
] | ||
"presets": ["@babel/preset-env"] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { gql } from 'apollo-server-express' | ||
import * as db from '../database' | ||
|
||
export const typeDefs = gql` | ||
extend type Query { | ||
getAllEventos: [Evento] | ||
getEvento(id: ID!): Evento | ||
getEventoByEmpresa(id_empresa: ID!): [Evento] | ||
} | ||
extend type Mutation{ | ||
changeStatusPedido(id_evento: ID!, estado_pedido: String): Evento! | ||
} | ||
type Evento { | ||
id_evento: ID! | ||
nombre_evento: String | ||
fecha: String | ||
hora_inicio: String | ||
hora_termino: String | ||
estado_pedido: String | ||
precio_entrada: Int | ||
direccion_evento: String | ||
lat_evento: String | ||
lng_evento: String | ||
descripcion_evento: String | ||
id_empresa: ID! | ||
} | ||
` | ||
|
||
export const resolvers = { | ||
Mutation:{ | ||
changeStatusPedido: async (obj, args, context, info) =>{ | ||
console.log(args.id_empresa); | ||
return Promise.all([ | ||
db.evento.update({ estado_pedido: args.estado_pedido}, | ||
{ where:{ id_evento: args.id_evento }}) | ||
]); | ||
|
||
} | ||
}, | ||
|
||
Query: { | ||
getAllEventos: async () => db.evento.findAll(), | ||
getEvento: async (obj, args, context, info) => | ||
db.evento.findByPk(args.id), | ||
getEventoByEmpresa: async (obj, args, context, info) => | ||
db.evento.findAll({ | ||
where:{ id_empresa: args.id_empresa } | ||
}), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { gql } from 'apollo-server-express' | ||
import * as db from '../database' | ||
|
||
export const typeDefs = gql` | ||
extend type Query { | ||
getAllEventoUsuarios: [EventoUsuario] | ||
getEventoUsuarioById(id: ID!): EventoUsuario | ||
getEventoUsuarioByUserId(id_usuario: ID!): [EventoUsuario] | ||
} | ||
type EventoUsuario { | ||
id: ID! | ||
id_evento: Int | ||
id_empresa: Int | ||
id_usuario: ID! | ||
evento: Evento | ||
} | ||
` | ||
//getEventoUsuarioByEvento(id_evento: ID!): [EventoUsuario] | ||
|
||
export const resolvers = { | ||
Query: { | ||
getAllEventoUsuarios: async () => db.evento_usuario.findAll(), | ||
getEventoUsuarioById: async (obj, args, context, info) => | ||
db.evento_usuario.findByPk(args.id), | ||
getEventoUsuarioByUserId: async (obj, args, context, info) => | ||
db.evento_usuario.findAll({ | ||
where:{id_usuario: args.id_usuario } | ||
}), | ||
}, | ||
EventoUsuario:{ | ||
evento: async (obj, args, context, info) => | ||
db.evento.findByPk(obj.id_evento), | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { gql } from 'apollo-server-express' | ||
import * as db from '../database' | ||
|
||
export const typeDefs = gql` | ||
extend type Query { | ||
getAllPedidos: [Pedido] | ||
getPedido(id: ID!): Pedido | ||
getPedidoByUser(id_usuario: ID!): [Pedido] | ||
getPedidoByEvento(id_evento: ID!): [Pedido] | ||
} | ||
type Pedido { | ||
id_pedido: ID! | ||
fecha_pedido: String | ||
hora_pedido: String | ||
turno_retiro: String | ||
estado: String | ||
id_usuario: ID! | ||
total_pedido: String | ||
id_evento: ID! | ||
} | ||
` | ||
|
||
export const resolvers = { | ||
Query: { | ||
getAllPedidos: async () => db.pedido.findAll(), | ||
getPedido: async (obj, args, context, info) => | ||
db.pedido.findByPk(args.id), | ||
getPedidoByUser: async (obj, args, context, info) => | ||
db.pedido.findAll({ | ||
where:{id_usuario: args.id_usuario | ||
} | ||
}), | ||
getPedidoByEvento: async (obj, args, context, info) => | ||
db.pedido.findAll({ | ||
where:{id_evento: args.id_evento | ||
} | ||
}), | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
module.exports = function(sequelize, DataTypes) { | ||
return sequelize.define('evento', { | ||
id_evento: { | ||
type: DataTypes.INTEGER(10).UNSIGNED, | ||
allowNull: false, | ||
primaryKey: true, | ||
autoIncrement: true | ||
}, | ||
nombre_evento: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
fecha: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
hora_inicio: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
hora_termino: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
estado_pedido: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
precio_entrada: { | ||
type: DataTypes.INTEGER(11), | ||
allowNull: false | ||
}, | ||
direccion_evento: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
lat_evento: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
lng_evento: { | ||
type: DataTypes.STRING(256), | ||
allowNull: false | ||
}, | ||
descripcion_evento: { | ||
type: DataTypes.STRING, | ||
allowNull: false | ||
}, | ||
id_empresa: { | ||
type: DataTypes.INTEGER(11), | ||
allowNull: false, | ||
references: { | ||
model: 'empresa', | ||
key: 'id_empresa' | ||
} | ||
} | ||
}, { | ||
tableName: 'evento', | ||
timestamps: false | ||
}); | ||
}; |
Oops, something went wrong.