Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create(budgetProps){
- const budget = new Budget(budgetProps);
- return budget.save();
- }
- {
- "data": {
- "addBudget": {
- "_id": "59fbdefaa7b0a81180dd2c9c",
- "tiempoAproximado": 2245.5,
- "User": {
- "name": null,
- "organization": null
- },
- "Vehicle": {
- "name": null,
- "type": null
- }
- }
- }
- }
- create(budgetProps){
- const budget = new Budget(budgetProps);
- return budget.save().then((res)=>{
- Budget.findById(res._id)
- .populate('User')
- .populate('Vehicle')
- .exec((err, newBudget)=> {
- return newBudget;
- });
- });
- },
- {
- "data": {
- "addBudget": null
- }
- }
- const typeDefs = `
- scalar Date
- input UserInput {
- _id: ID,
- name: String,
- organization: String,
- phones: [String],
- emails: [String],
- type: String,
- password: String,
- percentaje: String
- }
- input VehicleDescriptionInput {
- es: String,
- en: String
- }
- input VehicleInput{
- _id: ID,
- name: String,
- passengers: Int,
- largeBags: Int,
- smallBags: Int,
- doors: Int,
- type: String,
- status: Boolean,
- imagesUrls: [String],
- description: VehicleDescriptionInput
- }
- input FinalTotalCostInput {
- es: String,
- en: String
- }
- input BudgetTotalCostInput {
- es: String,
- en: String
- }
- input BudgetInput {
- finalTotalCost: FinalTotalCostInput,
- budgetTotalCost: BudgetTotalCostInput,
- destinoInicial: String,
- destinoFinal: String,
- tiempoAproximado: Float,
- distancia: Float,
- tollCost: Float,
- tolls: [String],
- budgetDate: Date,
- aprove: Boolean,
- User: UserInput,
- Vehicle: VehicleInput
- }
- type Mutation {
- addBudget(data: BudgetInput): Budget
- }
- `;
- Mutation: {
- addBudget: (_, {data}) =>{
- return BudgetController.create(data);
- }
- },
- mutation addBudget($budget: BudgetInput) {
- addBudget(data: $budget) {
- _id
- User{
- name
- organization
- }
- Vehicle{
- name
- type
- }
- }
- }
- {
- "budget": {
- "finalTotalCost": {
- "es": "100 peso",
- "en": "10 dolars"
- },
- "budgetTotalCost": {
- "es": "80 peso",
- "en": "8 dolars"
- },
- "destinoInicial": "Queretaro",
- "destinoFinal": "Sonora",
- "tiempoAproximado": 2245.5,
- "distancia": 100.565,
- "tollCost": 20.5,
- "tolls": [
- "GDL",
- "Marina",
- "Culap",
- "Malageña"
- ],
- "budgetDate": "2017/07/21",
- "aprove": false,
- "User": {
- "_id": "59fbcc42aa82460924e5fbad"
- },
- "Vehicle": {
- "_id": "59fbcbe4aa82460924e5fbac"
- }
- }
- }
Add Comment
Please, Sign In to add comment