mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix: record expense, item and item category date session.
fix: delete bulk accounts. fix: activate/inactive bulk accounts.
This commit is contained in:
@@ -23,7 +23,10 @@ export default class AccountsController extends BaseController{
|
||||
const router = Router();
|
||||
|
||||
router.post(
|
||||
'/bulk/:type(activate|inactivate)',
|
||||
'/bulk/:type(activate|inactivate)', [
|
||||
...this.bulkSelectIdsQuerySchema
|
||||
],
|
||||
this.validationResult,
|
||||
asyncMiddleware(this.bulkToggleActivateAccounts.bind(this))
|
||||
);
|
||||
router.post(
|
||||
@@ -74,6 +77,14 @@ export default class AccountsController extends BaseController{
|
||||
this.dynamicListService.handlerErrorsToResponse,
|
||||
this.catchServiceErrors,
|
||||
);
|
||||
router.delete(
|
||||
'/', [
|
||||
...this.bulkSelectIdsQuerySchema,
|
||||
],
|
||||
this.validationResult,
|
||||
asyncMiddleware(this.deleteBulkAccounts.bind(this)),
|
||||
this.catchServiceErrors,
|
||||
);
|
||||
router.delete(
|
||||
'/:id', [
|
||||
...this.accountParamSchema
|
||||
@@ -82,14 +93,6 @@ export default class AccountsController extends BaseController{
|
||||
asyncMiddleware(this.deleteAccount.bind(this)),
|
||||
this.catchServiceErrors,
|
||||
);
|
||||
router.delete(
|
||||
'/', [
|
||||
...this.bulkDeleteSchema,
|
||||
],
|
||||
this.validationResult,
|
||||
asyncMiddleware(this.deleteBulkAccounts.bind(this)),
|
||||
this.catchServiceErrors,
|
||||
);
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -149,7 +152,7 @@ export default class AccountsController extends BaseController{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
get bulkDeleteSchema() {
|
||||
get bulkSelectIdsQuerySchema() {
|
||||
return [
|
||||
query('ids').isArray({ min: 2 }),
|
||||
query('ids.*').isNumeric().toInt(),
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class Expense extends TenantModel {
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class Item extends TenantModel {
|
||||
/**
|
||||
* Model timestamps.
|
||||
*/
|
||||
static get timestamps() {
|
||||
get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ export default class Item extends TenantModel {
|
||||
* Model modifiers.
|
||||
*/
|
||||
static get modifiers() {
|
||||
const TABLE_NAME = Item.tableName;
|
||||
|
||||
return {
|
||||
sortBy(query, columnSort, sortDirection) {
|
||||
query.orderBy(columnSort, sortDirection);
|
||||
|
||||
@@ -10,6 +10,13 @@ export default class ItemCategory extends TenantModel {
|
||||
return 'items_categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
get timestamps() {
|
||||
return ['createdAt', 'updatedAt'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
|
||||
@@ -39,21 +39,9 @@ export default class Plan extends mixin(SystemModel) {
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const PlanFeature = require('system/models/Subscriptions/PlanFeature');
|
||||
const PlanSubscription = require('system/models/Subscriptions/PlanSubscription');
|
||||
|
||||
return {
|
||||
/**
|
||||
* The plan may have many features.
|
||||
*/
|
||||
features: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: PlanFeature.default,
|
||||
join: {
|
||||
from: 'subscriptions_plans.id',
|
||||
to: 'subscriptions_plan_features.planId',
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* The plan may have many subscriptions.
|
||||
*/
|
||||
@@ -62,7 +50,7 @@ export default class Plan extends mixin(SystemModel) {
|
||||
modelClass: PlanSubscription.default,
|
||||
join: {
|
||||
from: 'subscription_plans.id',
|
||||
to: 'subscription_plans.planId',
|
||||
to: 'subscription_plan_subscriptions.planId',
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user