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

feat: add rest and graphql endpoints for study rooms #29

Merged
merged 21 commits into from
Nov 24, 2024

Conversation

sanskarm7
Copy link
Contributor

Description

Created GraphQL and REST endpoints to provide study room data, namely:

  • allStudyRooms: Returns the id, name, capacity, location, and techEnhanced fields for each study room in the database.
  • studyRoomById: Returns the id, name, capacity, location, techEnhanced, description, and directions for a specific room, if available.
  • studyRoomsByFilters: Filters and returns study rooms based on query parameters (location, capacityMin, capacityMax, isTechEnhanced), providing the same fields as allStudyRooms.

Added description and directions fields to the studyRoomById endpoint to provide more details for each specific room.

Related Issue

resolves issue #2

Motivation and Context

These endpoints provide structured access to study room data in both REST and GraphQL formats, fulfilling the requirements outlined in issue #2. These changes allow users to access study room details as a whole, retrieve data for a specific room, or filter rooms based on criteria like location and capacity. This functionality is essential for making study room data available through the API in a scalable and flexible way.

How Has This Been Tested?

Tested locally on a development server using Postman. Verified:

REST Endpoints:

Access to /v2/rest/study-rooms/all returns all rooms.
Access to /v2/rest/study-rooms/{id} returns data for a specific room by ID.
Access to /v2/rest/study-rooms with query parameters returns filtered results.

GraphQL Queries:

Querying allStudyRooms returns a list of all study rooms with the expected fields.
Querying studyRoom(id: "<room_id>") returns details for a specific room, including description and directions if they are present.
Querying studyRooms(query: { location: "Science Library", capacityMin: 4 }) returns filtered results based on location and capacity.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code involves a change to the database schema.
  • My code requires a change to the documentation.

@ecxyzzy ecxyzzy self-requested a review November 13, 2024 23:28
Copy link
Member

@ecxyzzy ecxyzzy left a comment

Choose a reason for hiding this comment

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

We're moving away from implementing /all routes for resources in favor of paginated root routes that allow empty filters. Feel free to reference the courses/instructors routes for how to implement such an endpoint, or ask me or Andrew for help if necessary.

Other than that looks decent overall, left comments for minor nits though. Great work 💪

apps/api/src/rest/index.ts Outdated Show resolved Hide resolved
apps/api/src/rest/routes/study-rooms.ts Outdated Show resolved Hide resolved
apps/api/src/schema/study-rooms.ts Show resolved Hide resolved
apps/api/src/services/study-rooms.ts Outdated Show resolved Hide resolved
apps/api/src/services/study-rooms.ts Outdated Show resolved Hide resolved
apps/api/src/services/study-rooms.ts Outdated Show resolved Hide resolved
@ecxyzzy
Copy link
Member

ecxyzzy commented Nov 14, 2024

Oh also as a side note please make sure to make the PR name compliant with conventional commits before merging. Thanks 👍

Sanskar Mishra and others added 16 commits November 21, 2024 19:33
## Description

Add next app for creating & deleting api keys

## Related Issue

Closes #10 

## Motivation and Context

## How Has This Been Tested?

Tested locally. 

Setup:

```bash
docker compose up
pnpm run users-db:migrate
```

* Users cannot create /delete keys when not authed
* Users cannot create multiple keys

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My code involves a change to the database schema.
- [ ] My code requires a change to the documentation.
<!--- Provide a general summary of your changes in the Title above -->

## Description

Introduce & default light mode for API Key interface

<!--- Describe your changes in detail -->

## Related Issue

Closes #34 

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My code involves a change to the database schema.
- [ ] My code requires a change to the documentation.
## Description

Deploy key manager to AWS using SST Ion. DNS is still managed through
Cloudflare.

This honestly took me way longer than it should have because turns out
SST won't verify an ACM cert using Cloudflare, so I just gave up and
manually verified one, and passed in the cert ARN.

Also created a README with remarks on the lack of support for local
development. Hopefully we'll find a way to fix that soon, but the
deployment process is just so involved.

## Motivation and Context
Cloudflare Workers do not support parts of the Node.js crypto library,
which Auth.js requires.

## How Has This Been Tested?

Go to https://dashboard.anteaterapi.com.

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My code involves a change to the database schema.
- [ ] My code requires a change to the documentation.
<!--- Provide a general summary of your changes in the Title above -->

## Description

* Add disabled state to create / edit / delete buttons when in progress
* Add placeholders while pages are loading api key data

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

Closes #37 

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

Prevents sending multiple requests while in progress

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

Tested locally

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My code involves a change to the database schema.
- [ ] My code requires a change to the documentation.

Co-authored-by: Eddy Chen <[email protected]>
@sanskarm7 sanskarm7 changed the title added rest and graphql endpoints for study rooms feat: add rest and graphql endpoints for study rooms Nov 22, 2024
Copy link
Member

@ecxyzzy ecxyzzy left a comment

Choose a reason for hiding this comment

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

LGTM, great work on this!

We should look into returning the available slots as a potential followup though, as this PR doesn't seem to do that.

@ecxyzzy ecxyzzy merged commit 48b4f14 into main Nov 24, 2024
@ecxyzzy ecxyzzy deleted the study-rooms-endpoint branch November 24, 2024 05:56
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.

3 participants