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