ca1989
Make admin user "approve" database changes
I am working on an admin website where users can perform CRUD operations on resources.
When a user with an unprivileged role changes a resource R, that should not go online immediately, but only after an admin has approved the changes.
So what I did was to create a copy of R…
Problem is R has many linked subresources S1 ... SN.
So when the unprivileged user changes R and I create a copy R1 I should copy all the subresources as well, which doesn’t feel right.
Any other approach?
I thought about maintaining the original R in the database and a separate table to keep track of the changes.
The database is Postgresql
Cheers!
Marked As Solved
mayel
One approach could be storing the user suggested changes as a single map rather than in the relational tables, and only properly inserting them there on admin approval, like this function does for e.g.: paper_trail/lib/paper_trail.ex at main · bonfire-networks/paper_trail · GitHub (and using that lib would also give you version history)
Last Post!
ca1989
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security










