models/expensedb.py¶
models.expensedb ¶
ExpenseDB
ExpenseDB ¶
Bases: DBBase
Expense Collection
Source code in models/expensedb.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
add ¶
Add data, using pid
, tid
, _id
as the key to insert / update.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict
|
the data to insert / update. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Return the inserted / updated data. |
Source code in models/expensedb.py
index ¶
To make collection's index
Indexs
pid
,tid
pid
,tid
,request.buid
pid
,tid
,create_by
Source code in models/expensedb.py
new
staticmethod
¶
Create new data object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid |
str
|
project id |
required |
tid |
str
|
team id |
required |
uid |
str
|
user id |
required |
Struct
_id
: Unique expense id.pid
: Project id.tid
: Team id.dispense_id
: Reference to expense DB, if anyrequest
: This object include the budget data inbuid
,desc
,paydate
,code
.invoices
: List of invoice data, iniv_id
,currency
,name
,status
,total
,received
.bank
: User's bank account info, the data from user's real_profile in settings.status
: The mappings fromExpenseDB.status
.note
: Note fields, but not implememnt in expense page.code
: Random shorter code for reference in batch.releveant_code
: The codes are releveant to others.create_by
: Create by who inuid
.create_at
: When to created.enable
(bool
): enable or not.
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Return an base data object in |
TODO
Need refactor in pydantic.