mirror of
https://github.com/mvvasilev/personal-finances.git
synced 2025-04-19 14:19:52 +03:00
Re-fetch categories on import, add delete cascade of categorizations
This commit is contained in:
parent
6b0f3828a3
commit
3ec459da6f
3 changed files with 14 additions and 7 deletions
|
@ -391,7 +391,7 @@ public class CategoryService {
|
||||||
private CreateCategorizationDTO mapCategorizationForImport(CategorizationDTO cr) {
|
private CreateCategorizationDTO mapCategorizationForImport(CategorizationDTO cr) {
|
||||||
return new CreateCategorizationDTO (
|
return new CreateCategorizationDTO (
|
||||||
cr.rule().rule(),
|
cr.rule().rule(),
|
||||||
cr.ruleBasedOn().field(),
|
cr.ruleBasedOn() == null ? null : cr.ruleBasedOn().field(),
|
||||||
Optional.ofNullable(cr.stringValue()),
|
Optional.ofNullable(cr.stringValue()),
|
||||||
Optional.ofNullable(cr.numericGreaterThan()),
|
Optional.ofNullable(cr.numericGreaterThan()),
|
||||||
Optional.ofNullable(cr.numericLessThan()),
|
Optional.ofNullable(cr.numericLessThan()),
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE categories.categorization DROP CONSTRAINT FK_categorization_category;
|
||||||
|
|
||||||
|
ALTER TABLE categories.categorization
|
||||||
|
ADD CONSTRAINT FK_categorization_category FOREIGN KEY (category_id) REFERENCES categories.transaction_category(id) ON DELETE CASCADE;
|
|
@ -197,12 +197,15 @@ export default function CategoriesPage() {
|
||||||
|
|
||||||
toast.promise(
|
toast.promise(
|
||||||
utils.performRequest("/api/categories/import", {
|
utils.performRequest("/api/categories/import", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
}).then(resp => {
|
})
|
||||||
openUploadDialog(false);
|
.then(resp => fetchCategories())
|
||||||
utils.hideSpinner();
|
.then(resp => {
|
||||||
}),
|
setSelectedCategory(null);
|
||||||
|
openUploadDialog(false);
|
||||||
|
utils.hideSpinner();
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
loading: "Importing...",
|
loading: "Importing...",
|
||||||
success: "Imported",
|
success: "Imported",
|
||||||
|
|
Loading…
Add table
Reference in a new issue