Skip to content

Commit

Permalink
doc: update initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tc-imba committed Aug 19, 2024
1 parent bb84194 commit 530a6a6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Please follow this [guide](config/index.md) to configure it.
poe
```

Then, open `http://localhost:9000/brickapi/v1/docs`. If the swagger API page is shown, congratulations!
Then, open <http://localhost:9000/brickapi/v1/docs>. If the swagger API page is shown, congratulations!
Now you can move to the [next step](init.md) in initialize playground.
39 changes: 36 additions & 3 deletions docs/init.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# Initialization

## Register admin user
In this guide, most of the operations should be done on the swagger API page.
If you do not change port settings, it should be on <http://localhost:9000/brickapi/v1/docs>.

## Register user

=== "Username / Password"

1. Use the API `POST /brickapi/v1/auth/register` to register user.

`email`, `password` and `name` can be set in the request body.

```json
{
"email": "[email protected]",
"password": "string",
"name": "string"
}
```

2. Use the API `POST /brickapi/v1/auth/cookie/login` to login the registered user with cookie.

The `username` is same as the `email` set in the last step.


=== "Google OAuth2"

Before using this, ensure that [Google OAuth2](config/auth.md) has been setup in the configuration.

Use the API `/brickapi/v1/auth/cookie/google/authorize` and it will return a json response in the format
Use the API `GET /brickapi/v1/auth/cookie/google/authorize` and it will return a json response in the format

```json
{
Expand All @@ -22,9 +40,24 @@
The page will be redirected back to the [FRONTEND_URL](config/backend.md#frontend_url) entry in configuration.
By default, it is the url of the Swagger API if not set in configuration.

!!! info

Use the API `GET /brickapi/v1/users/me` to check user is successfully registered and logined.


!!! note

The admin user can also be registered in the frontend.
User can also be registered in the frontend.
However, it is recommanded to use the Swagger API for convenience of debugging the setup.

## Set superuser

Use the API `POST /brickapi/v1/users/init_superuser` to set the current user as superuser.
This API can only be called when no superuser exist in the system.


## Create domain

1. Use the API `POST /brickapi/v1/domains/{domain}` to create a new domain.
`domain` should be set to the name of the domain.
2.

0 comments on commit 530a6a6

Please sign in to comment.