ores.inbox.approval_decision
Table of Contents
A request is decided by many decisions, not one: a kind may need two approvers, and a hold, a return to waiting, a withdrawal, a refusal and a reversal are each a decision of their own. Each is a row here, and a decision is never edited.
Two rules of the record are rules of the schema. The person who asked cannot
decide their own request, and a withdrawal is the one decision only they take:
a hand-written trigger in inbox_approval_decision_rules_create.sql checks
both. One person approves a request at most once: the unique index below
states it.
1. Flags
2. Columns
2.1. id
UUID primary key for the decision.
2.2. request_id
The request this decision decides. FK reference to ores_inbox_approval_requests_tbl.
2.3. decision_code
What the decision does. FK reference to ores_inbox_approval_decision_types_tbl, which the system tenant holds.
2.4. part_code
The part of the request this decision answers, or null for a request that names no parts. FK reference to ores_inbox_approval_parts_tbl, which the system tenant holds. An approval of a part counts only for that part, and one person approves a request at most once, so each part is approved by a different person.
2.5. decided_by
The account that decided. FK reference to ores_iam_accounts_tbl.
2.6. decided_at
When the decision was taken.
std::chrono::system_clock::now()
2.7. hold_reason_code
Why the request was parked, when the decision is a hold. FK reference to ores_inbox_hold_reasons_tbl, which the system tenant holds. Null on every decision that is not a hold, and on the holds taken before the lookup existed, whose words are the comment alone.
std::nullopt
2.8. comment
Why, in the decider's words. Empty when neither the decision type nor the kind asks for one.
std::string(faker::lorem::sentence())
3. Foreign keys
3.1. request_id
3.2. decision_code
The lookup is system reference data, so the check reads the system tenant.
3.3. decided_by
3.4. part_code
The part the decision answers, when the request names parts.
3.5. hold_reason_code
Why a hold was taken, when the decision is a hold.
4. SQL
4.1. Flags
4.2. Indexes
One person approves a request at most once, so nobody counts twice towards the
kind's approvals_required.
| name | columns | unique | current_only | where_extra |
|---|---|---|---|---|
| one_approval_per_person | tenant_id, request_id, decided_by | true | true | decision_code = 'approve' |
5. C++
5.1. Flags
5.2. Repository
5.3. Domain includes
#include <string> #include <boost/uuid/uuid.hpp>
5.4. Conventions
5.5. Table display
| column | header |
|---|---|
| id | ID |
| request_id | Request |
| decision_code | Decision |
| decided_by | Decided By |
| decided_at | Decided At |
| modified_by | Modified By |
| version | Version |
5.6. Custom repository methods
6. See also
- Approval requests — the design this decision implements.
- ores.inbox.approval_request — the request a decision decides.
- ores.inbox.approval_decision_type — what a decision does.