Skip to content

OneSila is designed to help brands, retailers, and manufacturers crack the globalisation of their brands through e-commerce. OneSila handles multi-lingual, multi-channel, multi-currency and much more like a champion. Try us out.

License

Notifications You must be signed in to change notification settings

OneSila/OneSilaHeadless

Repository files navigation

codecov

OneSila Headless Backend

Quickstart

Install dependencies:

virtualenv venv
source venv/bin/active

pip install -r requirements.txt

Create your local settings:

cp OneSila/settings/local_template.py OneSila/settings/local.py

And create a postgres db + set the settings in your local.py setting file.

Next, migrate your db:

./manange.py migrate

Viewing docs

Docs 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:8000

Graphql

Getting 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"
    }
  }
}

Running tests

Runings tests, including coverage:

coverage run --source='.' manage.py test

To see the results

coverage report -m

Or with html

coverage html

About

OneSila is designed to help brands, retailers, and manufacturers crack the globalisation of their brands through e-commerce. OneSila handles multi-lingual, multi-channel, multi-currency and much more like a champion. Try us out.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages