[chore]: update contributing guide

This commit is contained in:
Lakhan Samani 2023-04-15 08:33:33 +05:30
parent 4e7ec6cb7b
commit a074f85391

View File

@ -45,12 +45,30 @@ Please ask as many questions as you need, either directly in the issue or on [Di
1. Fork the [authorizer](https://github.com/authorizerdev/authorizer) repository (**Skip this step if you have access to repo**) 1. Fork the [authorizer](https://github.com/authorizerdev/authorizer) repository (**Skip this step if you have access to repo**)
2. Clone repo: `git clone https://github.com/authorizerdev/authorizer.git` or use the forked url from step 1 2. Clone repo: `git clone https://github.com/authorizerdev/authorizer.git` or use the forked url from step 1
3. Change directory to authorizer: `cd authorizer` 3. Change directory to authorizer: `cd authorizer`
5. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/) 4. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/)
6. Build Dashboard `make build-dashboard` 5. Build Dashboard `make build-dashboard`
7. Build App `make build-app` 6. Build App `make build-app`
8. Build Server `make clean && make` 7. Build Server `make clean && make`
> Note: if you don't have [`make`](https://www.ibm.com/docs/en/aix/7.2?topic=concepts-make-command), you can `cd` into `server` dir and build using the `go build` command. In that case you will have to build `dashboard` & `app` manually using `npm run build` on both dirs. > Note: if you don't have [`make`](https://www.ibm.com/docs/en/aix/7.2?topic=concepts-make-command), you can `cd` into `server` dir and build using the `go build` command. In that case you will have to build `dashboard` & `app` manually using `npm run build` on both dirs.
9. Run binary `./build/server` 8. Run binary `./build/server`
### Updating GraphQL schema
- Modify `server/graph/schema.graphqls` file
- Run `make generate-graphql` this will update the models and required methods
- If a new mutation or query is added
- Write the implementation for the new resolver in `server/resolvers/NEW_RESOLVER.GO`
- Update `server/graph/schema.resolvers.go` with the new resolver method
### Adding support for new database
- Run `make generate-db-template dbname=NEW_DB_NAME`
eg `make generate-db-template dbname=dynamodb`
This command will generate a folder in server/db/providers/ with name specified in the above command.
One will have to implement methods present in that folder.
> Note: Connection for database and schema changes are written in `server/db/providers/DB_NAME/provider.go` > `NewProvider` method is called for any given db based on the env variables present.
### Testing ### Testing
@ -87,145 +105,145 @@ For manually testing using graphql playground, you can paste following queries a
```gql ```gql
mutation Signup { mutation Signup {
signup( signup(
params: { params: {
email: "lakhan@yopmail.com" email: "lakhan@yopmail.com"
password: "test" password: "test"
confirm_password: "test" confirm_password: "test"
given_name: "lakhan" given_name: "lakhan"
} }
) { ) {
message message
user { user {
id id
family_name family_name
given_name given_name
email email
email_verified email_verified
} }
} }
} }
mutation ResendEamil { mutation ResendEamil {
resend_verify_email( resend_verify_email(
params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" } params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" }
) { ) {
message message
} }
} }
query GetVerifyRequests { query GetVerifyRequests {
_verification_requests { _verification_requests {
id id
token token
expires expires
identifier identifier
} }
} }
mutation VerifyEmail { mutation VerifyEmail {
verify_email(params: { token: "" }) { verify_email(params: { token: "" }) {
access_token access_token
expires_at expires_at
user { user {
id id
email email
given_name given_name
email_verified email_verified
} }
} }
} }
mutation Login { mutation Login {
login(params: { email: "lakhan@yopmail.com", password: "test" }) { login(params: { email: "lakhan@yopmail.com", password: "test" }) {
access_token access_token
expires_at expires_at
user { user {
id id
family_name family_name
given_name given_name
email email
} }
} }
} }
query GetSession { query GetSession {
session { session {
access_token access_token
expires_at expires_at
user { user {
id id
given_name given_name
family_name family_name
email email
email_verified email_verified
signup_methods signup_methods
created_at created_at
updated_at updated_at
} }
} }
} }
mutation ForgotPassword { mutation ForgotPassword {
forgot_password(params: { email: "lakhan@yopmail.com" }) { forgot_password(params: { email: "lakhan@yopmail.com" }) {
message message
} }
} }
mutation ResetPassword { mutation ResetPassword {
reset_password( reset_password(
params: { token: "", password: "test", confirm_password: "test" } params: { token: "", password: "test", confirm_password: "test" }
) { ) {
message message
} }
} }
mutation UpdateProfile { mutation UpdateProfile {
update_profile(params: { family_name: "samani" }) { update_profile(params: { family_name: "samani" }) {
message message
} }
} }
query GetUsers { query GetUsers {
_users { _users {
id id
email email
email_verified email_verified
given_name given_name
family_name family_name
picture picture
signup_methods signup_methods
phone_number phone_number
} }
} }
mutation MagicLinkLogin { mutation MagicLinkLogin {
magic_link_login(params: { email: "test@yopmail.com" }) { magic_link_login(params: { email: "test@yopmail.com" }) {
message message
} }
} }
mutation Logout { mutation Logout {
logout { logout {
message message
} }
} }
mutation UpdateUser { mutation UpdateUser {
_update_user( _update_user(
params: { params: {
id: "dafc9400-d603-4ade-997c-83fcd54bbd67" id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
roles: ["user", "admin"] roles: ["user", "admin"]
} }
) { ) {
email email
roles roles
} }
} }
mutation DeleteUser { mutation DeleteUser {
_delete_user(params: { email: "signup.test134523@yopmail.com" }) { _delete_user(params: { email: "signup.test134523@yopmail.com" }) {
message message
} }
} }
``` ```