Skip to content

Commit

Permalink
feat: adds from/to to orders
Browse files Browse the repository at this point in the history
  • Loading branch information
eljefedelrodeodeljefe committed Aug 20, 2018
1 parent bc250b5 commit b5374c2
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 0 deletions.
111 changes: 111 additions & 0 deletions lib/common/address.js
@@ -0,0 +1,111 @@
module.exports = {
type: 'object',
additionalProperties: false,
properties: {
lines: {
oneOf: [
{
type: 'array',
minItems: 1,
maxItems: 4,
items: {
type: 'string',
minLength: 1
}
},
{
type: 'null'
}
]
},
street: {
oneOf: [
{
type: 'string'
},
{
type: 'null'
}
]
},
street_number: {
oneOf: [
{
type: 'string'
},
{
type: 'null'
}
]
},
locality: {
oneOf: [
{
type: 'string'
},
{
type: 'null'
}
]
},
region: {
oneOf: [
{
type: 'string'
},
{
type: 'null'
}
]
},
postal_code: {
oneOf: [
{
type: 'string',
maxLength: 10
},
{
type: 'null'
}
]
},
country: {
oneOf: [
{
type: 'string',
minLength: 2,
maxLength: 2,
pattern: '^[A-Z]{2}$'
},
{
type: 'null'
}
],
'default': null
},
type: {
oneOf: [
{
type: 'string',
'enum': [
'delivery',
'billing'
]
},
{
type: 'null'
}
]
}
},
required: [
'lines',
'street',
'street_number',
'locality',
'region',
'postal_code',
'country',
'type'
]
}
38 changes: 38 additions & 0 deletions lib/v0/orders/create.request.js
@@ -1,4 +1,5 @@
const orderItem = require('./items').create
const address = require('../../common/address')

module.exports = {
$id: 'https://schemas.tillhub.com/v0/orders.create.request.schema.json',
Expand Down Expand Up @@ -63,6 +64,43 @@ module.exports = {
}
]
},
from: {
descrption: 'from which Tillhub resource, that is able to handle stock, a delivery is coming from. E.g. branch, warehouse, shelve, client',
oneOf: [
{
type: 'string',
format: 'uuid'
},
{
type: 'null'
}
]
},
to: {
descrption: 'from which Tillhub resource, that is able to handle stock, a delivery is going to. E.g. branch, warehouse, shelve, client',
oneOf: [
{
type: 'string',
format: 'uuid'
},
{
type: 'null'
}
]
},
recipient: {
type: 'object',
additionalProperties: false,
properties: {
address
}
},
sender: {
type: 'object',
properties: {
address
}
},
order_items: {
type: 'array',
minItems: 1,
Expand Down

0 comments on commit b5374c2

Please sign in to comment.