开发者

Maker/ Checker Design Module

开发者 https://www.devze.com 2022-12-22 16:49 出处:网络
i want to design maker/ checker module in my project like if user A add new u开发者_运维百科ser so the another User B will approve or reject this adding. i want to know the best practices of design fo

i want to design maker/ checker module in my project like if user A add new u开发者_运维百科ser so the another User B will approve or reject this adding. i want to know the best practices of design for this module in the database ....... any help


This sounds like business logic to me - hence your module? While there might be an element of database design in a good dolution that's not the main issue (you might want to re-tag the question with some other terms).

I would start by designing the module on paper: use UML (if you know it) to map out what the module needs to do, think about the different cases of use. A state diagram sounds like it'd be useful, maybe some sequence diagrams.

Once you understand all that the database part should be straight forward.

Are you building a database from stratch or adding to an existing system?

If it's part of an existing database you'll need to understand that, and leverage the existing data as much as appropriate.

The approval process you describe is basically a Workflow - have a look at some workflow related information for more ideas, but for a basic solution I imagine some sort of flag in teh newly created record, and links to the users who take action (adding the record, approving it, etc). You might also want to record all actions in a seperate 'audit' table of some kind. Best practice? - Ensure you maintain refentai integrity.


In LedgerSMB we do something similar for financial transactions. User A adds, user B approves. These have separate database permissions. User A can insert. User B can run a function which updates. This can be enforced at the database level or not, though we primarily enforce it at the application level.

Basically everything has an approved_by field and where this IS NULL, the document has not been approved. Where it is not null it has. We also have an entered_by, and an optional constraint that entered_by <> approved_by although to my knowledge nobody is using that because currently all my users have a business requirement that certain people are allowed to approve their own entries.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号