Campaigns Table
campaigns/campaigns.py¶
CampaignsDB ¶
CampaignsDB(dburi='localhost/tm_admin')
Bases: DBSupport
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dburi |
str
|
The URI string for the database connection |
'localhost/tm_admin'
|
Returns:
Type | Description |
---|---|
UsersDB
|
An instance of this class |
Source code in tm_admin/campaigns/campaigns.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
mergeOrganizations
async
¶
mergeOrganizations(inpg)
A method to merge the contents of the TM campaign_organizations into the campaigns table as an array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inpg |
PostgresClient
|
The input database |
required |
Source code in tm_admin/campaigns/campaigns.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
mergeProjects
async
¶
mergeProjects(inpg)
A method to merge the contents of the TM campaign_projects into the campaigns table as an array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inpg |
PostgresClient
|
The input database |
required |
Source code in tm_admin/campaigns/campaigns.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/campaigns/campaigns.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
options: show_source: false heading_level: 3
campaigns/campaigns_class.py¶
options: show_source: false heading_level: 3
campaigns/api.py¶
CampaignsAPI ¶
CampaignsAPI()
Bases: PGSupport
Returns:
Type | Description |
---|---|
CampaignsAPI
|
An instance of this class |
Source code in tm_admin/campaigns/api.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
initialize
async
¶
initialize(inuri)
Connect to all tables for API endpoints that require accessing multiple tables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inuri |
str
|
The URI for the TM Admin output database |
required |
Source code in tm_admin/campaigns/api.py
76 77 78 79 80 81 82 83 84 85 86 87 |
|
getByID
async
¶
getByID(campaign_id)
Get all the information for an campaign using it's ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
campaign_id |
int
|
The campaign to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the campaign information |
Source code in tm_admin/campaigns/api.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
getByName
async
¶
getByName(name)
Get all the information for a campaign using the name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The campaign to get the data for |
required |
Returns:
Type | Description |
---|---|
dict
|
the campaign information |
Source code in tm_admin/campaigns/api.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
create
async
¶
create(campaign)
Create a campaign and add it to the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
campaign |
CampaignsTable
|
The team data |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether the campaign got created |
Source code in tm_admin/campaigns/api.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
update
async
¶
update(campaign)
Update a campaign that is already in the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
campaign |
CampaignsTable
|
The campaign data |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether the campaign got updated |
Source code in tm_admin/campaigns/api.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
main
async
¶
main()
This main function lets this class be run standalone by a bash script.
Source code in tm_admin/campaigns/api.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
options: show_source: false heading_level: 3