Skip to content

Commit a074f85

Browse files
committed
[chore]: update contributing guide
1 parent 4e7ec6c commit a074f85

File tree

1 file changed

+124
-106
lines changed

1 file changed

+124
-106
lines changed

.github/CONTRIBUTING.md

Lines changed: 124 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,30 @@ Please ask as many questions as you need, either directly in the issue or on [Di
4545
1. Fork the [authorizer](https://github.com/authorizerdev/authorizer) repository (**Skip this step if you have access to repo**)
4646
2. Clone repo: `git clone https://github.com/authorizerdev/authorizer.git` or use the forked url from step 1
4747
3. Change directory to authorizer: `cd authorizer`
48-
5. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/)
49-
6. Build Dashboard `make build-dashboard`
50-
7. Build App `make build-app`
51-
8. Build Server `make clean && make`
48+
4. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/)
49+
5. Build Dashboard `make build-dashboard`
50+
6. Build App `make build-app`
51+
7. Build Server `make clean && make`
5252
> 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.
53-
9. Run binary `./build/server`
53+
8. Run binary `./build/server`
54+
55+
### Updating GraphQL schema
56+
57+
- Modify `server/graph/schema.graphqls` file
58+
- Run `make generate-graphql` this will update the models and required methods
59+
- If a new mutation or query is added
60+
- Write the implementation for the new resolver in `server/resolvers/NEW_RESOLVER.GO`
61+
- Update `server/graph/schema.resolvers.go` with the new resolver method
62+
63+
### Adding support for new database
64+
65+
- Run `make generate-db-template dbname=NEW_DB_NAME`
66+
eg `make generate-db-template dbname=dynamodb`
67+
68+
This command will generate a folder in server/db/providers/ with name specified in the above command.
69+
One will have to implement methods present in that folder.
70+
71+
> 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.
5472
5573
### Testing
5674

@@ -87,145 +105,145 @@ For manually testing using graphql playground, you can paste following queries a
87105

88106
```gql
89107
mutation Signup {
90-
signup(
91-
params: {
92-
93-
password: "test"
94-
confirm_password: "test"
95-
given_name: "lakhan"
96-
}
97-
) {
98-
message
99-
user {
100-
id
101-
family_name
102-
given_name
103-
email
104-
email_verified
105-
}
106-
}
108+
signup(
109+
params: {
110+
111+
password: "test"
112+
confirm_password: "test"
113+
given_name: "lakhan"
114+
}
115+
) {
116+
message
117+
user {
118+
id
119+
family_name
120+
given_name
121+
email
122+
email_verified
123+
}
124+
}
107125
}
108126

109127
mutation ResendEamil {
110-
resend_verify_email(
111-
params: { email: "[email protected]", identifier: "basic_auth_signup" }
112-
) {
113-
message
114-
}
128+
resend_verify_email(
129+
params: { email: "[email protected]", identifier: "basic_auth_signup" }
130+
) {
131+
message
132+
}
115133
}
116134

117135
query GetVerifyRequests {
118-
_verification_requests {
119-
id
120-
token
121-
expires
122-
identifier
123-
}
136+
_verification_requests {
137+
id
138+
token
139+
expires
140+
identifier
141+
}
124142
}
125143

126144
mutation VerifyEmail {
127-
verify_email(params: { token: "" }) {
128-
access_token
129-
expires_at
130-
user {
131-
id
132-
email
133-
given_name
134-
email_verified
135-
}
136-
}
145+
verify_email(params: { token: "" }) {
146+
access_token
147+
expires_at
148+
user {
149+
id
150+
email
151+
given_name
152+
email_verified
153+
}
154+
}
137155
}
138156

139157
mutation Login {
140-
login(params: { email: "[email protected]", password: "test" }) {
141-
access_token
142-
expires_at
143-
user {
144-
id
145-
family_name
146-
given_name
147-
email
148-
}
149-
}
158+
login(params: { email: "[email protected]", password: "test" }) {
159+
access_token
160+
expires_at
161+
user {
162+
id
163+
family_name
164+
given_name
165+
email
166+
}
167+
}
150168
}
151169

152170
query GetSession {
153-
session {
154-
access_token
155-
expires_at
156-
user {
157-
id
158-
given_name
159-
family_name
160-
email
161-
email_verified
162-
signup_methods
163-
created_at
164-
updated_at
165-
}
166-
}
171+
session {
172+
access_token
173+
expires_at
174+
user {
175+
id
176+
given_name
177+
family_name
178+
email
179+
email_verified
180+
signup_methods
181+
created_at
182+
updated_at
183+
}
184+
}
167185
}
168186

169187
mutation ForgotPassword {
170-
forgot_password(params: { email: "[email protected]" }) {
171-
message
172-
}
188+
forgot_password(params: { email: "[email protected]" }) {
189+
message
190+
}
173191
}
174192

175193
mutation ResetPassword {
176-
reset_password(
177-
params: { token: "", password: "test", confirm_password: "test" }
178-
) {
179-
message
180-
}
194+
reset_password(
195+
params: { token: "", password: "test", confirm_password: "test" }
196+
) {
197+
message
198+
}
181199
}
182200

183201
mutation UpdateProfile {
184-
update_profile(params: { family_name: "samani" }) {
185-
message
186-
}
202+
update_profile(params: { family_name: "samani" }) {
203+
message
204+
}
187205
}
188206

189207
query GetUsers {
190-
_users {
191-
id
192-
email
193-
email_verified
194-
given_name
195-
family_name
196-
picture
197-
signup_methods
198-
phone_number
199-
}
208+
_users {
209+
id
210+
email
211+
email_verified
212+
given_name
213+
family_name
214+
picture
215+
signup_methods
216+
phone_number
217+
}
200218
}
201219

202220
mutation MagicLinkLogin {
203-
magic_link_login(params: { email: "[email protected]" }) {
204-
message
205-
}
221+
magic_link_login(params: { email: "[email protected]" }) {
222+
message
223+
}
206224
}
207225

208226
mutation Logout {
209-
logout {
210-
message
211-
}
227+
logout {
228+
message
229+
}
212230
}
213231

214232
mutation UpdateUser {
215-
_update_user(
216-
params: {
217-
id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
218-
roles: ["user", "admin"]
219-
}
220-
) {
221-
email
222-
roles
223-
}
233+
_update_user(
234+
params: {
235+
id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
236+
roles: ["user", "admin"]
237+
}
238+
) {
239+
email
240+
roles
241+
}
224242
}
225243

226244
mutation DeleteUser {
227-
_delete_user(params: { email: "[email protected]" }) {
228-
message
229-
}
245+
_delete_user(params: { email: "[email protected]" }) {
246+
message
247+
}
230248
}
231249
```

0 commit comments

Comments
 (0)