123456789101112131415161718192021222324252627 |
- const express = require('express');
- const path = require('path');
- const Actions = require('../../systems/ActionSystem');
- const OneToOne = require('../../base/OneToOne');
- // USELESS
- class AddressOrderHookup extends OneToOne {
- constructor(){
- super('/addresses', [1,1,1,1,3], 'Addresses', 'Orders', '', undefined);
- Actions.on("verifyOrder" , this.verify.bind(this));
- }
- verify(order) {
- if (!order["Addresses_id"])
- throw "No address id";
- let id = order["Addresses_id"];
- return this.repository.get('id', id)
- .then((res) => {
- if(res.length) {
- return order;
- }
- throw 'No such address with id: ' + id;
- });
- }
- }
- module.exports = AddressOrderHookup;
|