Install dependencies:
virtualenv venv source venv/bin/active pip install -r requirements.txtCreate your local settings:
cp OneSila/settings/local_template.py OneSila/settings/local.pyAnd create a postgres db + set the settings in your local.py setting file. Also add CORS settings to your local file.
CORS_ALLOWED_ORIGINS = [ "http://localhost:5173", # check the right port from your frontend npm run dev. ] 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" } } }Images can be uploaded in bulk by calling the uploadImagesFromUrls mutation. Each entry accepts the image URL, type, and an optional title:
mutation uploadImagesFromUrls { uploadImagesFromUrls( urls: [ { url: "https://example.com/product.jpg", type: "PACK", title: "Front shot" } ] ) { id title } }Runings tests, including coverage:
coverage run --source='.' manage.py testTo see the results
coverage report -mOr with html
coverage htmlThe list of available currencies can be found in currencies/currencies.py. Each entry contains the ISO code, human readable name and symbol. Recent additions include codes such as AFN (Afghan Afghani) and CHF (Swiss Franc).