fixed bug where transactions couldn't be created without category
This commit is contained in:
@@ -51,6 +51,7 @@ class CategoriesService {
|
||||
if (!category) {
|
||||
throw new BadRequest('category does not exist')
|
||||
}
|
||||
// TODO this needs to reallocate all transactions under this category to unassigned
|
||||
category.remove()
|
||||
return category
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import { logger } from '../utils/Logger'
|
||||
|
||||
class TransactionsService {
|
||||
async create(newTransaction) {
|
||||
if (newTransaction.categoryId == '') {
|
||||
newTransaction.categoryId = null
|
||||
}
|
||||
const dbTransaction = await dbContext.Transactions.create(newTransaction)
|
||||
if (!dbTransaction) {
|
||||
throw new BadRequest("transaction does not exist")
|
||||
|
||||
Reference in New Issue
Block a user