mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: add models fields labels.
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
import { Router, Request, Response, NextFunction } from 'express';
|
import { Router, Request, Response, NextFunction } from 'express';
|
||||||
import { check, param, query, ValidationChain, matchedData } from 'express-validator';
|
import { check, param, query, ValidationChain } from 'express-validator';
|
||||||
import asyncMiddleware from 'api/middleware/asyncMiddleware';
|
import asyncMiddleware from 'api/middleware/asyncMiddleware';
|
||||||
import ItemsService from 'services/Items/ItemsService';
|
import ItemsService from 'services/Items/ItemsService';
|
||||||
import BaseController from 'api/controllers/BaseController';
|
import BaseController from 'api/controllers/BaseController';
|
||||||
import DynamicListingService from 'services/DynamicListing/DynamicListService';
|
import DynamicListingService from 'services/DynamicListing/DynamicListService';
|
||||||
import { ServiceError } from 'exceptions';
|
import { ServiceError } from 'exceptions';
|
||||||
import { IItemDTO } from 'interfaces';
|
import { IItemDTO } from 'interfaces';
|
||||||
import { Request } from 'express-validator/src/base';
|
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export default class ItemsController extends BaseController {
|
export default class ItemsController extends BaseController {
|
||||||
|
|||||||
@@ -45,4 +45,14 @@ export default {
|
|||||||
// config: true,
|
// config: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
manual_journals: [
|
||||||
|
{
|
||||||
|
key: 'journal_number_next',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'journal_number_prefix',
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
]
|
||||||
};
|
};
|
||||||
@@ -43,5 +43,29 @@
|
|||||||
"Credit": "Credit",
|
"Credit": "Credit",
|
||||||
"Interest": "Interest",
|
"Interest": "Interest",
|
||||||
"Depreciation": "Depreciation",
|
"Depreciation": "Depreciation",
|
||||||
"Payroll": "Payroll"
|
"Payroll": "Payroll",
|
||||||
|
"Type": "Type",
|
||||||
|
"Name": "Name",
|
||||||
|
"Sellable": "Sellable",
|
||||||
|
"Purchasable": "Purchasable",
|
||||||
|
"Sell price": "Sell price",
|
||||||
|
"Cost price": "Cost price",
|
||||||
|
"User": "User",
|
||||||
|
"Category": "Category",
|
||||||
|
"Note": "Note",
|
||||||
|
"Quantity on hand": "Quantity on hand",
|
||||||
|
"Purchase description": "Purchase description",
|
||||||
|
"Sell description": "Sell description",
|
||||||
|
"Sell account": "Sell account",
|
||||||
|
"Cost account": "Cost account",
|
||||||
|
"Inventory account": "Inventory account",
|
||||||
|
"Payment date": "Payment date",
|
||||||
|
"Payment account": "Payment account",
|
||||||
|
"Amount": "Amount",
|
||||||
|
"Reference No.": "Reference No.",
|
||||||
|
"Published": "Published",
|
||||||
|
"Journal number": "Journal number",
|
||||||
|
"Status": "Status",
|
||||||
|
"Journal type": "Journal type",
|
||||||
|
"Date": "Date"
|
||||||
}
|
}
|
||||||
@@ -125,33 +125,42 @@ export default class Expense extends TenantModel {
|
|||||||
static get fields() {
|
static get fields() {
|
||||||
return {
|
return {
|
||||||
payment_date: {
|
payment_date: {
|
||||||
|
label: 'Payment date',
|
||||||
column: 'payment_date',
|
column: 'payment_date',
|
||||||
},
|
},
|
||||||
payment_account: {
|
payment_account: {
|
||||||
|
label: 'Payment account',
|
||||||
column: 'payment_account_id',
|
column: 'payment_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
|
label: 'Amount',
|
||||||
column: 'total_amount',
|
column: 'total_amount',
|
||||||
},
|
},
|
||||||
currency_code: {
|
currency_code: {
|
||||||
|
label: 'Currency',
|
||||||
column: 'currency_code',
|
column: 'currency_code',
|
||||||
},
|
},
|
||||||
reference_no: {
|
reference_no: {
|
||||||
|
label: 'Reference No.',
|
||||||
column: 'reference_no'
|
column: 'reference_no'
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
|
label: 'Description',
|
||||||
column: 'description',
|
column: 'description',
|
||||||
},
|
},
|
||||||
published: {
|
published: {
|
||||||
|
label: 'Published',
|
||||||
column: 'published',
|
column: 'published',
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
|
label: 'User',
|
||||||
column: 'user_id',
|
column: 'user_id',
|
||||||
relation: 'users.id',
|
relation: 'users.id',
|
||||||
relationColumn: 'users.id',
|
relationColumn: 'users.id',
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
|
label: 'Created at',
|
||||||
column: 'created_at',
|
column: 'created_at',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,64 +103,83 @@ export default class Item extends TenantModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item fields.
|
||||||
|
*/
|
||||||
static get fields() {
|
static get fields() {
|
||||||
return {
|
return {
|
||||||
type: {
|
type: {
|
||||||
|
label: 'Type',
|
||||||
column: 'type',
|
column: 'type',
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
|
label: 'Name',
|
||||||
column: 'name',
|
column: 'name',
|
||||||
},
|
},
|
||||||
sellable: {
|
sellable: {
|
||||||
|
label: 'Sellable',
|
||||||
column: 'sellable',
|
column: 'sellable',
|
||||||
},
|
},
|
||||||
purchasable: {
|
purchasable: {
|
||||||
|
label: 'Purchasable',
|
||||||
column: 'purchasable',
|
column: 'purchasable',
|
||||||
},
|
},
|
||||||
sell_price: {
|
sell_price: {
|
||||||
|
label: 'Sell price',
|
||||||
column: 'sell_price'
|
column: 'sell_price'
|
||||||
},
|
},
|
||||||
cost_price: {
|
cost_price: {
|
||||||
|
label: 'Cost price',
|
||||||
column: 'cost_price',
|
column: 'cost_price',
|
||||||
},
|
},
|
||||||
currency_code: {
|
currency_code: {
|
||||||
|
label: 'Currency',
|
||||||
column: 'currency_code',
|
column: 'currency_code',
|
||||||
},
|
},
|
||||||
cost_account: {
|
cost_account: {
|
||||||
|
label: 'Cost account',
|
||||||
column: 'cost_account_id',
|
column: 'cost_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
sell_account: {
|
sell_account: {
|
||||||
|
label: 'Sell account',
|
||||||
column: 'sell_account_id',
|
column: 'sell_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
inventory_account: {
|
inventory_account: {
|
||||||
|
label: "Inventory account",
|
||||||
column: 'inventory_account_id',
|
column: 'inventory_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
sell_description: {
|
sell_description: {
|
||||||
|
label: "Sell description",
|
||||||
column: 'sell_description',
|
column: 'sell_description',
|
||||||
},
|
},
|
||||||
purchase_description: {
|
purchase_description: {
|
||||||
|
label: "Purchase description",
|
||||||
column: 'purchase_description',
|
column: 'purchase_description',
|
||||||
},
|
},
|
||||||
quantity_on_hand: {
|
quantity_on_hand: {
|
||||||
|
label: "Quantity on hand",
|
||||||
column: 'quantity_on_hand',
|
column: 'quantity_on_hand',
|
||||||
},
|
},
|
||||||
note: {
|
note: {
|
||||||
|
label: 'Note',
|
||||||
column: 'note',
|
column: 'note',
|
||||||
},
|
},
|
||||||
category: {
|
category: {
|
||||||
|
label: "Category",
|
||||||
column: 'category_id',
|
column: 'category_id',
|
||||||
relation: 'categories.id',
|
relation: 'categories.id',
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
|
label: 'User',
|
||||||
column: 'user_id',
|
column: 'user_id',
|
||||||
relation: 'users.id',
|
relation: 'users.id',
|
||||||
relationColumn: 'users.id',
|
relationColumn: 'users.id',
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
|
label: 'Created at',
|
||||||
column: 'created_at',
|
column: 'created_at',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,40 +42,52 @@ export default class ItemCategory extends TenantModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item category fields.
|
||||||
|
*/
|
||||||
static get fields() {
|
static get fields() {
|
||||||
return {
|
return {
|
||||||
name: {
|
name: {
|
||||||
|
label: 'Name',
|
||||||
column: 'name',
|
column: 'name',
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
|
label: 'Description',
|
||||||
column: 'description',
|
column: 'description',
|
||||||
},
|
},
|
||||||
parent_category_id: {
|
parent_category_id: {
|
||||||
|
label: 'Parent category',
|
||||||
column: 'parent_category_id',
|
column: 'parent_category_id',
|
||||||
relation: 'items_categories.id',
|
relation: 'items_categories.id',
|
||||||
relationColumn: 'items_categories.id',
|
relationColumn: 'items_categories.id',
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
|
label: 'User',
|
||||||
column: 'user_id',
|
column: 'user_id',
|
||||||
relation: 'users.id',
|
relation: 'users.id',
|
||||||
relationColumn: 'users.id',
|
relationColumn: 'users.id',
|
||||||
},
|
},
|
||||||
cost_account: {
|
cost_account: {
|
||||||
|
label: 'Cost account',
|
||||||
column: 'cost_account_id',
|
column: 'cost_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
sell_account: {
|
sell_account: {
|
||||||
|
label: 'Sell account',
|
||||||
column: 'sell_account_id',
|
column: 'sell_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
inventory_account: {
|
inventory_account: {
|
||||||
|
label: 'Inventory account',
|
||||||
column: 'inventory_account_id',
|
column: 'inventory_account_id',
|
||||||
relation: 'accounts.id',
|
relation: 'accounts.id',
|
||||||
},
|
},
|
||||||
cost_method: {
|
cost_method: {
|
||||||
|
label: 'Cost method',
|
||||||
column: 'cost_method',
|
column: 'cost_method',
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
|
label: 'Created at',
|
||||||
column: 'created_at',
|
column: 'created_at',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ export default class ManualJournal extends TenantModel {
|
|||||||
return ['createdAt', 'updatedAt'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static get resourceable() {
|
static get resourceable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -67,32 +64,41 @@ export default class ManualJournal extends TenantModel {
|
|||||||
static get fields() {
|
static get fields() {
|
||||||
return {
|
return {
|
||||||
date: {
|
date: {
|
||||||
|
label: 'Date',
|
||||||
column: 'date',
|
column: 'date',
|
||||||
},
|
},
|
||||||
journal_number: {
|
journal_number: {
|
||||||
|
label: 'Journal number',
|
||||||
column: 'journal_number',
|
column: 'journal_number',
|
||||||
},
|
},
|
||||||
reference: {
|
reference: {
|
||||||
|
label: 'Reference No.',
|
||||||
column: 'reference',
|
column: 'reference',
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
|
label: 'Status',
|
||||||
column: 'status',
|
column: 'status',
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
|
label: 'Amount',
|
||||||
column: 'amount',
|
column: 'amount',
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
|
label: 'Description',
|
||||||
column: 'description',
|
column: 'description',
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
|
label: 'User',
|
||||||
column: 'user_id',
|
column: 'user_id',
|
||||||
relation: 'users.id',
|
relation: 'users.id',
|
||||||
relationColumn: 'users.id',
|
relationColumn: 'users.id',
|
||||||
},
|
},
|
||||||
journal_type: {
|
journal_type: {
|
||||||
|
label: 'Journal type',
|
||||||
column: 'journal_type',
|
column: 'journal_type',
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
|
label: 'Created at',
|
||||||
column: 'created_at',
|
column: 'created_at',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user