feat: Customers resource.

This commit is contained in:
Ahmed Bouhuolia
2020-06-08 18:50:04 +02:00
parent fe240c058b
commit d915813195
8 changed files with 613 additions and 36 deletions

View File

@@ -294,5 +294,11 @@ export default (tenantDb) => {
};
});
factory.define('customer', 'customers', async () => {
return {
customer_type: 'business',
};
});
return factory;
}

View File

@@ -1,8 +1,42 @@
exports.up = function(knex) {
return knex.schema.createTable('customers', table => {
table.increments();
table.string('customer_type');
table.string('first_name').nullable();
table.string('last_name').nullable();
table.string('company_name').nullable();
table.string('display_name');
table.string('email').nullable();
table.string('work_phone').nullable();
table.string('personal_phone').nullable();
table.string('billing_address_1').nullable();
table.string('billing_address_2').nullable();
table.string('billing_address_city').nullable();
table.string('billing_address_country').nullable();
table.string('billing_address_email').nullable();
table.string('billing_address_zipcode').nullable();
table.string('billing_address_phone').nullable();
table.string('billing_address_state').nullable(),
table.string('shipping_address_1').nullable();
table.string('shipping_address_2').nullable();
table.string('shipping_address_city').nullable();
table.string('shipping_address_country').nullable();
table.string('shipping_address_email').nullable();
table.string('shipping_address_zipcode').nullable();
table.string('shipping_address_phone').nullable();
table.string('shipping_address_state').nullable();
table.text('note');
table.boolean('active').defaultTo(true);
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('customers');
};

View File

@@ -10,6 +10,7 @@ exports.seed = (knex) => {
{ id: 3, name: 'expenses' },
{ id: 4, name: 'manual_journals' },
{ id: 5, name: 'items_categories' },
{ id: 6, name: 'customers' },
]);
});
};