Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add main branch content for Session 3 #3

Open
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

MaryamZi
Copy link
Contributor

@MaryamZi MaryamZi commented May 1, 2024

Purpose

$title.

@@ -1 +1,387 @@
# Backend implementation for Reviewed!

A backend implementation for Reviewed!, a platform to review places.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use backticks for Reviewed!.?
Just to imply that it is a name not a verb?


Ballerina requires `distinct` objects (which is Ballerina's way of allowing nominal type-like behaviour) with interfaces and unions to differentiate between the possible return types.

- Now that done we're done with the core service implementations, next (level 7), let's introduce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Now that done we're done with the core service implementations, next (level 7), let's introduce
- Now we're done with the core service implementations, next (level 7), let's introduce


- Maximum query depth - introduced in the service annotation, this restricts the depth of the query to avoid unnecessary processing for abnormal/malicious queries.

- Data loaders - Ballerina supports data loaders that allow avoiding the GraphQL N + 1 problem via batching and caching. In this version, we've only introduced the data loader for the city data retrieval calls, but we can introduce data loaders for database access too. Also see [GraphQL data loader](https://ballerina.io/learn/by-example/graphql-dataloader/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Data loaders - Ballerina supports data loaders that allow avoiding the GraphQL N + 1 problem via batching and caching. In this version, we've only introduced the data loader for the city data retrieval calls, but we can introduce data loaders for database access too. Also see [GraphQL data loader](https://ballerina.io/learn/by-example/graphql-dataloader/).
- Data loaders - Ballerina supports data loaders that allow avoiding the GraphQL N + 1 problem via batching and caching. In this version, we've only introduced the data loader for the city data retrieval calls, but we can introduce data loaders for database access, too. Also, see [GraphQL data loader](https://ballerina.io/learn/by-example/graphql-dataloader/).


- Data loaders - Ballerina supports data loaders that allow avoiding the GraphQL N + 1 problem via batching and caching. In this version, we've only introduced the data loader for the city data retrieval calls, but we can introduce data loaders for database access too. Also see [GraphQL data loader](https://ballerina.io/learn/by-example/graphql-dataloader/).

- Enabling SSL - set the relevant `secureSocket` configuration when creating the listener. Also see [GraphQL service security](https://ballerina.io/learn/by-example/#graphql-service-security).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Enabling SSL - set the relevant `secureSocket` configuration when creating the listener. Also see [GraphQL service security](https://ballerina.io/learn/by-example/#graphql-service-security).
- Enabling SSL - set the relevant `secureSocket` configuration when creating the listener. Also, see [GraphQL service security](https://ballerina.io/learn/by-example/#graphql-service-security).


- Enabling SSL - set the relevant `secureSocket` configuration when creating the listener. Also see [GraphQL service security](https://ballerina.io/learn/by-example/#graphql-service-security).

- Field-level authorization - a simple (hard-coded) user ID-based authorization has been introduced to the `addPlace` mutation. The user ID from a request header is set to [the GraphQL context](https://ballerina.io/learn/by-example/graphql-context/) which is then accessed at field-level via a [field interceptor](https://ballerina.io/learn/by-example/graphql-field-interceptors/) to check if the user is authorized to add a place.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Field-level authorization - a simple (hard-coded) user ID-based authorization has been introduced to the `addPlace` mutation. The user ID from a request header is set to [the GraphQL context](https://ballerina.io/learn/by-example/graphql-context/) which is then accessed at field-level via a [field interceptor](https://ballerina.io/learn/by-example/graphql-field-interceptors/) to check if the user is authorized to add a place.
- Field-level authorization - a simple (hard-coded) user ID-based authorization has been introduced to the `addPlace` mutation. The user ID from a request header is set to [the GraphQL context](https://ballerina.io/learn/by-example/graphql-context/), which is then accessed at field-level via a [field interceptor](https://ballerina.io/learn/by-example/graphql-field-interceptors/) to check if the user is authorized to add a place.


This will generate the schema at the specified [output path](./reviewed/schema/schema_reviewed.graphql).

- Note: if you want to enable GraphiQL and/or introspection, add the following also in the config file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Note: if you want to enable GraphiQL and/or introspection, add the following also in the config file.
- Note: If you want to enable GraphiQL and/or introspection, add the following also to the config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants