Install dependencies:
virtualenv venv
source venv/bin/active
pip install -r requirements.txtCreate your local settings:
cp OnekeyrIng/settings/local_template.py OnekeyrIng/settings/local.pyAnd create a postgres db + set the settings in your local.py setting file.
Next, migrate your db:
./manange.py migrateDocs are housed inside of the docs folder. You can view them easily by running mkdocs serve like so:
source venv/bin/active
mkdocs serve
# Now open: http://127.0.0.1:8000Getting data out of - and putting in - is done using graphql. eg, creating a company via (graphiql)[http://127.0.0.1:8080/graphql/]:
mutation createCompany {
createCompany(data: {name: "Company ltd"}) {
id
name
multiTenantCompany{
name
}
}
}will yield:
{
"data": {
"createCompany": {
"id": "Q29tcGFueVR5cGU6OQ==",
"name": "Company ltd",
"multiTenantCompany": {
"name": "Owner"
}
}
}
}You can also subscribe to it's updates:
subscription companySubscriptionClass {
company(pk: "Q29tcGFueVR5cGU6OQ==") {
id
name
createdAt
updatedAt
}
}will yield:
{
"data": {
"company": {
"id": "Q29tcGFueVR5cGU6OQ==",
"name": "Company ltd",
"createdAt": "2023-10-03T16:11:21.900275+00:00",
"updatedAt": "2023-10-03T16:11:21.900310+00:00"
}
}
}Runings tests, including coverage:
coverage run --source='.' manage.py testTo see the results
coverage report -mOr with html
coverage html