distributeaid / toolbox

DistributeAid Toolbox
http://distributeaid.org
GNU Affero General Public License v3.0
3 stars 1 forks source link

Simpler Mods #30

Closed pedro-gutierrez closed 4 years ago

pedro-gutierrez commented 4 years ago

Is your feature request related to a problem? Please describe.

At the moment the implementation we have around mods and mod values is a bit complex, and hard to maintain imho. :)

Describe the solution you'd like

A more tree like structure, where entities are simpler and relationships are of type child to parent (many to one). Eg:

Database tables:

Table Column DataType Comments
mods id integer primary key, autoincremented
category_id integer foreign key to categories (not sure about this)
name string unique
type string integer, select, multi-select
description string
mod_values id integer primary key, autoincremented
mod_id integer foreign key to mods
value string
items_mods id integer primary key, autoincremented
mod_id integer foreign key to mods
item_id integer foreign_key to item
entries id integer primary key, autoincremented
list_id integer foreign key to lists
item_id integer foreign key to items
amount integer
entries_mod_values id integer primary key, autoincremented
entry_id integer foreign key to entry
mod_value_id integer foreign key to mod_values

This schema allows the following operation relatively easily:

At the application level (either on the frontend, or on the backend) we can:

Questions:

pedro-gutierrez commented 4 years ago

Fixed by #32