models/budgetdb.py¶
models.budgetdb ¶
BudgetDB
BudgetDB ¶
Bases: DBBase
Budget Collection
Source code in /home/runner/work/COSCUP-Volunteer/COSCUP-Volunteer/models/budgetdb.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 |
|
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 /home/runner/work/COSCUP-Volunteer/COSCUP-Volunteer/models/budgetdb.py
edit ¶
Edit data, using the _id
as the key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_id |
str
|
the budget id. |
required |
data |
dict
|
the data need to update. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Return the updated data. |
Source code in /home/runner/work/COSCUP-Volunteer/COSCUP-Volunteer/models/budgetdb.py
index ¶
To make collection's index
Indexs
pid
,tid
pid
,bid
Source code in /home/runner/work/COSCUP-Volunteer/COSCUP-Volunteer/models/budgetdb.py
new
staticmethod
¶
Create new
Struct
_id
: Unique budget id.pid
: Project id.tid
: Team id.bid
: This buDget id is from the google spreadsheet by serials in manually.name
: Team name.uid
: User id.currency
: Now only support inTWD
,USD
.total
: 0.00paydate
:str
In ISO8601 format orYYYY-MM-DD
.desc
: Descrption.estimate
: more descriptions in how to estimate the total.code
: Random shorter code for reference in batch.enabled
:bool
.create_at
: The created date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid |
str
|
project id |
required |
tid |
str
|
team id |
required |
uid |
str
|
user id |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Return an base data object in |
TODO
Need refactor in pydantic.
Source code in /home/runner/work/COSCUP-Volunteer/COSCUP-Volunteer/models/budgetdb.py
Last update:
June 6, 2022