Coder Social home page Coder Social logo

backend's Introduction

Buddy Matcher
Class Buddy Matcher

Group project for SOFTENG 701 Team 1 (Backend)


Class Buddy Matcher - Group project for SOFTENG 701 Team 1 (Backend).

This project comprises the backend segment (API + database) of the Buddymatcher application. It was created using Spring Boot and uses H2 for its database system.

How to run the app

The run configuration should look like the image below. The API can be accessed at localhost:8080/api/

image

Credentials

The app's login system is done through Sign In With Google, and hence this project's API is associated with a google account. For the credentials for this account, please refer to one of the original team members.

Authentication

Details on the authentication flow and use of tokens can be found in the frontend wiki here.

Testing the app

Integration testing

Before creating a pull request, you should make sure your backend still passes all the tests with your changes. You can do this with Intellij by opening the Maven popup on the right side of the IDE and running "test" under Lifecycle. You don't need to have the app running before this step - the testing will take care of it.

image

If successful, the output should look like this:

image

Note, while all requests to endpoints are normally prehandled, this is bypassed in the endpoint tests so no need to worry about authentication.

Manual testing

If you would like to manually test the app, you can hit any endpoint you'd like using Postman or Swagger. To test the API this way, you will need to pass in a custom JWT in your request. See Authentication above for how it works.

Project structure

Information about the backend project structure can be found here.

backend's People

Contributors

alexmiao7 avatar arathibiju avatar dlee432 avatar dogeliness avatar ejstuart avatar f-fromont avatar hiin3d55 avatar jafarmaash avatar kimslor avatar nicholasbatesnz avatar r055a avatar rayaway2020 avatar scorpionknifes avatar shreyasingaraju avatar shreytailor avatar thatrandomcodernz avatar thomasholsteruoa avatar uoa-ppat965 avatar yuliapechorina avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

backend's Issues

Remove ChatObject Class from Socket Package

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Class was just included so that PR reviewers could make sure that the Sockets were connected. Needs to be removed.

Describe how a solution to your proposed task might look like (and any alternatives considered).

Deleting the class. Replacing it with our own Object Models.

Notes

Initial Backend Project Configuration

Describe the task that needs to be done.

This issue requests the setup of the java backend for the project, it requires setting up the file structure, setting up maven, spring and junit

Describe how a solution to your proposed task might look like (and any alternatives considered).
For the java backend of the project the technology we are using is spring as the application framework, Maven for project management and Junit 5 for the testing framework, JPA for Object-Relational-Mapping of the database to the application.

.
└───backend
    └───src
        ├───main
        │   ├───java
        │   │   └───com
        │   │       └───team701
        │   │           └───buddymatcher
        │   │               ├───controllers
        │   │               ├───domain
        │   │               ├───repositories
        │   │               └───services
        │   │   
        │   └───resources
        └───test
            └───java
                └───com
                    └───team701
                        └───buddymatcher
                            ├───controllers
                            └───services

Above is the proposed directory structure,
The controllers directory will have all the controller files which handle the user requests from the frontend
The domain directory will hold the classes defining the conceptual objects used by the program
The services directory will hold the classes that define the accessible endpoints
The respositories directory will hold the classes relating to the database that is used

The resources directory will hold property/configuration data for the server

The test directories map to the directories in the main program, and are where the corresponding unit/integration tests for each component will be kept

Notes

  • The backend team has agreed on using jdk 17, Spring, Maven, Junit 5, JPA

Create README.md

Describe the task that needs to be done.
We need to create a readme to help people get familiar with this repo as well as how to run/test/use it, it is an important part of the documentation

Notes

  • ideally is a similar format to the frontend readme

Setting up Socket I/O library in Java

Describe the task that needs to be done.

Set up Socket I/O library to use for continuous communication between users.

Describe how a solution to your proposed task might look like (and any alternatives considered).

There would be a Socket I/O library in the project for creating events for communication

Notes

As discussed in Communications meeting.

Implement the logic for addBuddy endpoint

Describe the task that needs to be done.
After the blank endpoint is created for the addBuddy endpoint in the Pairing service, the actual logic and implementation needs to be complete with appropriate testing

Depends on: #28
Blocking: #50

Describe how a solution to your proposed task might look like (and any alternatives considered).
The endpoint takes in a AddBuddyDTO which is a DTO to represent a JSON body that is passed in with the post request. This request contains a userId and buddyId

The addBuddy endpoint needs to:

  • (TBC with user team) Authorize that the user who is sending the request is the user
  • Verify that the userId and buddyId exist in the User table
  • Check to make sure that the buddy is not already added to the user
  • Make a change to both users (user & buddy) updating their buddy lists to contain each id
  • (TBC with communication team) send out a chat message for both users with a welcome message (TBD, needs approval from the communication team)
  • Corresponding response code is returned based on success/failure

Response codes:
201 Created, if new buddy record is created
404 Not Found, if either id does not exist
400 Bad request, if a buddy match already exists between users
(TBD) 403 not authorized, if the user authentication system is set up (added as a later issue)

Notes

  • Authorization will be confirmed with user team, and added in a later issue
  • Communication team will be consulted in regards to welcome message, added in a later issue

Fix code owners paths

Describe the task that needs to be done.
Currently all service and repository tests have the wrong path in the CODEOWNERS file, which means that if changes are made to these tests, reviewers are not automatically requested.

Current paths:
image

Describe how a solution to your proposed task might look like (and any alternatives considered).
Change main to test in the paths e.g.
/src/main/java/com/team701/buddymatcher/services/users/ @uoa-ypec413 @jafarmaash

/src/test/java/com/team701/buddymatcher/services/users/ @uoa-ypec413 @jafarmaash

Notes

Timetable File Processing

Describe the task that needs to be done.
Work out how to take in timetable file (only .ics) and process it to get specific courses (and any other information).
Need to look into the file format and options for upload.

Describe how a solution to your proposed task might look like (and any alternatives considered).
.ics file can be read and relevant information stored in database seperately

Notes
Dependent on database solution being decided and framework implemented - #13

Setup Communication Data Models

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Create data models and DTOs for messages, chatrooms etc.

Describe how a solution to your proposed task might look like (and any alternatives considered).

Have models and DTOs setup for getting data through endpoints

Notes

Implement Socket I/O Online Event

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Create and implement an event that sends to a client whenever a new user joins the socket i/o.

Describe how a solution to your proposed task might look like (and any alternatives considered).

Wrap join event with a user id

Notes

As discussed in communications group meeting (see meeting minutes in wiki)

Team issue labels

Describe the task that needs to be done.

In our meeting on 15th March, the team had proposed that we should have issue labels for each team to have more organisation. Having these labels would also make it possible to filter issues by your team, and this is great if you're looking to pick up an issue to work on.

Describe how a solution to your proposed task might look like (and any alternatives considered).

N/A

Notes

N/A

Changing from spring-fox to springdoc for underlying swagger-ui depdency

Describe the task that needs to be done.
The current dependency used for swagger-ui is spring-fox, there is a known issue with the versions of each of these dependencies we are usinghttps://stackoverflow.com/questions/70178343/springfox-3-0-0-is-not-working-with-spring-boot-2-6-0

This wasn't a problem up till now since we had the @EnableWebMVC annotation on our application class which seemed to hide the affect, but this shouldn't be something required to do, and it actually prevented other contexts from being used in the testing suite

currently blocking #60

E.g unable to use @DataJpaTest for creating tests on the database, due to the servletContext being fixed by the @EnableWebMVC annotation

Describe how a solution to your proposed task might look like (and any alternatives considered).
Solution is to change the underlying swagger depdency from springfox to springdocs, the depdency is easily fixed with the following
<!-- Dependency for swagger --> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.6.6</version> </dependency>
Changes also need to be made to the current annotations used
These include
@Api -> @tag(name ="name of service")
@ApiOperation -> @operation(desc = "describe endpoint")

Finally the swagger config needs to be changed to the following
`@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI springShopOpenAPI() {
    return new OpenAPI()
            .info(new Info().title("SpringShop API")
                    .description("Spring shop sample application")
                    .version("v0.0.1")
                    .license(new License().name("Apache 2.0").url("http://springdoc.org")))
            .externalDocs(new ExternalDocumentation()
                    .description("SpringShop Wiki Documentation")
                    .url("https://springshop.wiki.github.org/docs"));
}

}`

Notes
https://springdoc.org/#migrating-from-springfox
This document helps in walking through the steps to migrate from springfox

Refactor pairing endpoints to use authorisation

Describe the task that needs to be done.
Currently, the endpoints can be accessed by anyone, and it would be better to secure the endpoint so that only authorised users are able to send requests to these endpoints

Depends on: #47 #48 #49 #33

Describe how a solution to your proposed task might look like (and any alternatives considered).
Once the user team sets up the tokens in the user database, we will be able to check if a request has the correct matching token to the token in the database.

We can then have a utility function that gets the id of the user who sent the request based on their token,
This has 2 benefits, it allows us to ensure only authorised users can make requests to these endpoints
and it also means we can access the userId of the sending user, rather than requiring it to be sent through

An example of the refactor could be the removal for sending the userID in addBuddy, instead the userId could be gather based on the access token
Notes

Implement API Specification for Endpoints

Describe the task that needs to be done.
Setting up to do the implemented endpoints (using swagger)

(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).
This will allow us to describe the entire API

Describe how a solution to your proposed task might look like (and any alternatives considered).
The proposed solution is an API that we will be able to drive the development further.

Notes
Specification discussed in initial communication group meeting (see meeting minutes in wiki)

Create a basic endpoint for testing server

Describe the task that needs to be done.
Adding a basic endpoint to the server that can be used by the team to check that the repo is installed and runs properly
Priority is medium to get it done before the backend team meeting so that we can make sure it is working for everyone

Describe how a solution to your proposed task might look like (and any alternatives considered).
Adding a new BasicService that has a single endpoint that can be called to test when the server is running
Notes

Thorough testing of SocketIO send/receive message events

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

#72 was not able to be properly tested as the front-end code was not implemented at the time of creating this issue. Make sure it works properly.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Manual testing and verification

Notes
Relates to #44

Endpoint to store uploaded timetable file

Describe the task that needs to be done.
Create API endpoint that stores uploaded .ics file

Describe how a solution to your proposed task might look like (and any alternatives considered).
API endpoint can take in a uploaded .ics file and stores that file in a temporary folder.

Notes
Discussed in meeting on 14/03, is just for when a file is uploaded, not provided via URL

Decide on database implementation to use

Describe the task that needs to be done.
As a team we need to decide the type of database that we want to use for the backend.
Currently H2 (an in memory database) is being used to allow the server to run, this was because without any database being used the spring framework used will not start up. See PR #14

Describe how a solution to your proposed task might look like (and any alternatives considered).
We could stick with the current database used: H2
We could look at implementing a different database like: mySQL (this would have the added benefits of consistency for tests)
We could also consider other database options
Notes

Implement Endpoint Logic for Sending and Subcribing to Messages

Describe the task that needs to be done.
Implement the endpoint logic for communications/messages to retrieve message history

Describe how a solution to your proposed task might look like (and any alternatives considered).
Functional message sending + subscription

Notes

Add auth method to get called before every endpoint

Describe the task that needs to be done.
Add the auth method which will automatically get called every time before someone calls an endpoint.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Potentially use spring HandlerInterceptor to prehandle every HTTP request (see link in notes below)
This checks that the given JWT exists in the user table - could use some existing JWT library
Take the user ID (and any other relevant info in the token) and add it as a session attribute so the endpoint method can then access it (see links in notes for example)
Remove id from UserDTO

Notes
This was discussed and agreed on in a Users team meeting on 14/03 - see meeting minutes in the wiki
Aim to complete by Wednesday night :) (16/03)

Useful links:
Handler interceptor
https://www.baeldung.com/spring-mvc-handlerinterceptor

Example code using it
https://github.com/eugenp/tutorials/blob/master/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java

Change ical4j dependency version to 3.2.1

Describe the task that needs to be done.
Currently the ical4j library is at version 4.0.0-alpha8
This is causing an error with the iterator() method which prevents compilation:
image

Describe how a solution to your proposed task might look like (and any alternatives considered).
Bump down ical4j dependency version from 4.0.0-alpha8 -> 3.2.1

Notes

Document pairing algorithm processes

Describe the task that needs to be done.
Documentation about the pairing algorithm including how the pairing starts, how the pairing works and all the paths users can go(choose one specific paper/multiple ones, actions like send/refuse request?) to give both the front-end design and back-end messaging team more clear identifications.

Describe how a solution to your proposed task might look like (and any alternatives considered).
A wiki file in repo to record all the decisions and ideas have been brought up.

Notes

Implement Basic Courses endpoint in Timetable Controller

Describe the task that needs to be done.
In the PR SE701-T1/frontend#77 from the frontend there is two API endpoints getCourses and getCourse that is relied on.

/**
 * Fetches the data of all courses in the timetable
 * @return {Promise} data of all the courses
 */
export const getCourses = async () => [
  {
    courseId: 1214,
    name: 'SOFTENG 701',
    semester: '2022 sem 1',
    studentCount: 10,
    buddyCount: 4,
    updatedTime: 1647383521,
  }
];

/**
 * Fetches the data of the course with the course id
 * @param {number} courseId id of the course to retrieve
 * @return {Promise} data of the given course
 */
export const getCourse = async (courseId) => ({
  courseId,
  name: 'SOFTENG 701',
  semester: '2022 sem 1',
  studentCount: 10,
  buddyCount: 4,
  updatedTime: 1647383521,
});

Describe how a solution to your proposed task might look like (and any alternatives considered).

Implement these endpoints

Notes

Backend Wiki to point to front-end wiki

Describe the task that needs to be done.
A wiki page needs to be created for the backend, explaining and linking towards the front-end repo wiki.
We are doing this to consolidate all our wiki documents in one place (one repo) rather than duplicating and doubling the work for any new wiki additions.

Describe how a solution to your proposed task might look like (and any alternatives considered).
A wiki page added to the backend
Notes

Add meeting minutes to the wiki

Describe the task that needs to be done.
We need our meeting minutes that are kept in the google drive to be shifted to the wiki

Describe how a solution to your proposed task might look like (and any alternatives considered).
Someone just needs to copy and add the correct markup
Notes

Removing unused import from AddBuddyDTO

Describe the task that needs to be done.
an Unused import was left in the AddBuddyDTO class

Describe how a solution to your proposed task might look like (and any alternatives considered).
removing the unused import
import org.springframework.web.bind.annotation.ModelAttribute;
Notes

Decide on user and timetable information storing

Describe the task that needs to be done.
Communicate between user and timetable teams to decide how to store user data, including courses they take.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Know how timetables fit into the user data structure

Notes

Creation of PersistanceManager for database context

Describe the task that needs to be done.
The persistence manager will return an entity manager which represents a session with a database or persistence context
Describe how a solution to your proposed task might look like (and any alternatives considered).
I will use Javax.persistence classes and a singleton class to manage entity manager creation, following common jpa methods
Notes

Investigate Adding Swagger to Java REST API

Describe the task that needs to be done.

Look into adding Swagger to our back-end for easy documenting & testing of endpoints. If possible and reasonable add Swagger to the project.

Describe how a solution to your proposed task might look like (and any alternatives considered).

A separate swagger webpage with documentation of endpoints.

Create issue template

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue)

The group needs to follow common conventions, and this means that everyone should be using the same markdown layout when creating issues for our project to keep this consistent. Therefore, we should create a template for automating this process.

Describe how a solution to your proposed task might look like (and any alternatives considered).

GitHub allows developers to create templates within a directory called .github in the root directory, so we can place our template file here. The layout should be whatever the team agrees with, but it should have common elements like the task that needs to be done, potential solution etc.

Notes

N/A

Implement Send/Receive Message Events

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Implement Send/Receive message socket events. Depends on #38

Describe how a solution to your proposed task might look like (and any alternatives considered).

SendMessage - sends message to a room (client -> server)

{
    sender_id: “the id of self”
    receiver_id: “the id of the user you sending to”
    message: “string”
    timestamp: “unix time”
}

ReceiveMessage - server sends client a message (server -> client)

{
    sender_id: “the id of sender”
    receiver_id: “the id of the receiver”
    message: “string”
    timestamp: ”unix time”
}

Notes
As discussed in communications meeting 14/03/22 (see minutes in wiki)

Add Code Owners

Describe the task that needs to be done.
Code owners need to be added so that the right people are automatically requested for review when PRs are made in directories relevant to them.

Describe how a solution to your proposed task might look like (and any alternatives considered).

Chosen option: 2
For shared directories, have 1 person from each team as code owners

Options considered:

  1. All backend devs (11 people) are set as code owners for the entire repository
    Pros:
    Easy to set up and maintain code owners
    Cons:
    All 11 people will be requested for review when a PR is made
  2. We divide the file structure into features. Each team is code owners for their features
    e.g.
    image
    Pros:
    Only the team relevant to the PR will be requested for review
    Cons:
    Will need to setup code owners for many different directories (controllers, services, tests etc.)
    Not sure what to do for any shared directories
    Hard to maintain when project structure changes
  3. Elect 2 code owners for the entire repository
    Pros:
    Easy to set up and maintain
    Only 2 people will be requested for review automatically
    Cons:
    Need to elect people

Notes
This issue was approved in the Backend team meeting on 11/03/2022 (see wiki for minutes)

Create endpoint for Adding Buddy

Describe the task that needs to be done.
Set up endpoint and documentation for adding a buddy by communicating with 'Users'.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Set up empty endpoint methods with descriptions for adding a buddy that will show up on swagger.

Endpoint: addBuddy
Path: /api/pairing/
Request: Current User ID and added buddy's User ID.
Operation: PUT
Response: 200 OK. Adds new buddy's User ID to current user's array of all buddies.

Notes

Setup course and enrolment schematic

Describe the task that needs to be done.
The pairing team needs a database that shows the students who are associated with a course, this will be used to perform efficient matches

Describe how a solution to your proposed task might look like (and any alternatives considered).
The proposed solution will be two new tables

COURSE
courseID {primary key}(long) | courseName (String) | year/semester (string) | student count (integer) | timeUpdated (timestamp)

ENROLMENT
courseID {FK}(long) | studentID {FK}(long) | timeCreated (timestamp)
Notes

Create endpoint for Matching a Buddy

Describe the task that needs to be done.
Set up endpoint and documentation for matching a User with a buddy.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Set up empty endpoint methods with descriptions for matching a buddy that will show up on swagger.

Endpoint: matchBuddy
Path: /api/pairing/
Request: Array of Course ID's and User ID's
Operation: GET
Response: 200 OK.

Notes

User backend setup

Describe the task that needs to be done.
Setup User entity, DTO, repository, service and controller.

Describe how a solution to your proposed task might look like (and any alternatives considered).
User entity fields:

  • id: UUID
  • name: string
  • email: string
  • pair: Pair
  • authCookie: String/Cookie

Endpoints:

Retrieving users
GET /users/{id}
Response:
200 OK w/ User Entity

Notes
This issue was approved in the Users team meeting on 12/03/2022 (see wiki for minutes)

Create Contributing Guidelines

Describe the task that needs to be done.
Contribution guidelines are a way to communicate how people should contribute and help them verify that they're submitting well-formed pull requests and opening useful issues.

Describe how a solution to your proposed task might look like (and any alternatives considered).
A contributing guidelines markdown file file should be added to the root of the repository so people can access it easily. Naming this file CONTRIBUTING.md ensures when someone opens a pull request or creates an issue, they will see a link to the file.

Notes

Endpoint setup for backend communications

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Setup the endpoints and documentation for communications controller.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Empty endpoint methods with descriptions that will show up on swagger.

Notes

Implement Socket I/O Read Event

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue. You can also include screenshots of any stack traces, or any other supporting images).

Create and implement an event that flags a message as read by the user.

Describe how a solution to your proposed task might look like (and any alternatives considered).

Socket I/O event that updates history of messages with a flag that a message has been read.

Notes

As discussed in communications group meeting (see meeting minutes in wiki)

Implement Endpoint Logic for Retrieving Message History

Describe the task that needs to be done.
Implement the endpoint logic for communications/history to retrieve message history

Describe how a solution to your proposed task might look like (and any alternatives considered).
Functional endpoints

Notes

Endpoint to take in Timetable URL

Describe the task that needs to be done.
Create API endpoint that downloads .ics file given URL input

Describe how a solution to your proposed task might look like (and any alternatives considered).
API endpoint can take in a URL to download ICS file, downloads it and stores that file in a temporary folder.

Notes
Discussed in meeting on 14/03, is just for when a URL is supplied, not a file.

Implement logic for removeBuddy Endpoint

Describe the task that needs to be done.
After the blank endpoint is created for the removeBuddy endpoint in the Pairing service, the actual logic and implementation needs to be complete with appropriate testing

Depends on: #29
Blocking: #50

Describe how a solution to your proposed task might look like (and any alternatives considered).
The endpoint takes in a buddyId which is the id of the buddy to remove

The addBuddy endpoint needs to:

  • (TBC with user team) Authorize that the user who is sending the request is the user
  • Verify that the buddyId exist in the User table
  • Check to make sure that the buddy is added to the user
  • Make a change to both users (user & buddy) updating their buddy lists to not contain each id
  • (TBC with communication team) send out a message to delete the archive (TBD, needs approval from the communication team)
  • Corresponding response code is returned based on success/failure

Response codes:
200 Ok, if the operation was successful
404 Not Found, if buddy id does not exist
400 Bad request, if a buddy match does not exist between users
(TBD) 403 not authorized, if the user authentication system is set up (added as a later issue)

Notes

  • Authorization will be confirmed with user team, and added in a later issue
  • Communication team will be consulted in regards to welcome message, added in a later issue

Rename Pair entity to Buddies

Describe the task that needs to be done.
The Pair entity currently has a list of User instances, this entity should be renamed to Buddies as a list implies there could be more than 2 users.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Rename Pair entity to Buddies
Update pair field in User entity to buddies

Notes

Implement login endpoint

Describe the task that needs to be done.
Implement the endpoint to log users in

Describe what a solution to your proposed task might look like (and any alternatives considered).
When users sign in with Google in the frontend, the client is given an ID token which it can then pass to the backend. In the backend, we could take that token and verify it using Google's API. Once verified, there are two options:

  • If the user/email doesn't exist in our database:
    • register them and maybe prompt to import timetable?
  • If the user/email does exist in our database:
    • Create a session for them - see next line down

Once the token is verified, generate our own JWT to pass back to the front end when returning, containing the user ID

Notes
Aim to complete by Wednesday night :) (16/03)

Some links:
https://developers.google.com/identity/protocols/oauth2/web-server
https://developers.google.com/identity/gsi/web/guides/verify-google-id-token

This issue was approved in the Users team meeting on 12/03/2022 (see wiki for minutes)

Add Code of Conduct

Describe the task that needs to be done.
Added a code of conduct to root directory. Needs to be reviewed by team and approved for merge.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Any updates or changes suggested by team can be made before merging.

Notes

Create PR template

Describe the task that needs to be done.
(If this issue is about a bug, please describe the problem and steps to reproduce the issue)

The group needs to follow common conventions, and this means that everyone should be using the same markdown layout when creating pull requests for our project to keep this consistent. Therefore, we should create a template for automating this process.

Describe how a solution to your proposed task might look like (and any alternatives considered).

GitHub allows developers to create templates within a directory called .github in the root directory, so we can place our template file here. The layout should be whatever the team agrees with, but it should have common elements like description, testing notes, and a checklist to ensure consistency with the existing codebase.

Notes

N/A

Implement Timetable endpoint

Describe the task that needs to be done.
Set up a timetable endpoint with dummy data

Describe how a solution to your proposed task might look like (and any alternatives considered).
Create the necessary Spring classes to serve dummy data at /api/timetable with a user id as a parameter

Notes
The actual timetable structure hasn't been decided yet so the specific configuration is subject to change
Approved via discussion within timetabling team

Add user endpoint to disable/enable pairing

Describe the task that needs to be done.
We need an endpoint to disable/enable pairing for a user so that a user can opt in to being paired with a buddy.

Describe how a solution to your proposed task might look like (and any alternatives considered).
Add a pairingEnabled boolean field to the User entity

Options for endpoint:

  1. Update pairingEnabled field through an endpoint which accepts a UserDTO in the request body
    PUT api/users/{id}
    Request:
    Path param: User id
    Request body: UserDTO
    Response:
    200 OK w/ updated User entity
    404 Not Found

Pros:

  • Can be reused for any other fields that may need to be updated

Cons:

  • Need check for whether any fields are left out of the UserDTO, and not update those fields in the database. If Pair in the DTO is null, how do we determine whether the pair is being intentionally set to null to remove the pair?
  1. Update pairingEnabled field through an endpoint which accepts a pairingEnabled boolean query parameter
    PUT api/users/{id}?pairingEnabled=
    Request:
    Path param: User id
    Query param: pairingEnabled boolean
    Response:
    200 OK w/ updated User entity
    404 Not Found

Pros:

  • No confusion as to what field of User should be updated in the database

Cons:

  • We don't have a generic update user endpoint

Notes
Need input from User and Pairing teams

Population of course-student schema when a calendar is added

Describe the task that needs to be done.
When a user uploads their calendar the timetable backend team created an endpoint that returns a list of strings with each string being a course name that the student is apart of.

This issue is for creating an internal method that takes in that list of strings and also the id of the student, and the method will handle the creation of any new course classes, and if the course is already present, it will ensure that the user is added to that course

This is needed to make the matching process efficient

Describe how a solution to your proposed task might look like (and any alternatives considered).

A method like

public void populateCourses(Long studentId, List<String> courses)

This method will iterate through the list of courses and either:

  1. Create a new course entity if the entity does not exist in the current database
  2. If a course by the name already exists, then it will add the studentId to that course

Notes

Create endpoint for Removing Buddy

Describe the task that needs to be done.
Set up endpoint and documentation for removing a buddy by communicating with 'Users'

Describe how a solution to your proposed task might look like (and any alternatives considered).
Set up empty endpoint methods with descriptions for removing a buddy that will show up on swagger.

Endpoint: removeBuddy
Path: /api/pairing/
Request: Array of user's buddy ID's and buddy to remove User ID.
Operation: DELETE
Response: 200 OK.

Notes

Implement the logic of the matchBuddy endpoint

Describe the task that needs to be done.
After the blank endpoint is created for the matchBuddy endpoint in the Pairing service, the actual logic and implementation needs to be complete with appropriate testing

Depends on #30 #22
Blocking: #50

Describe how a solution to your proposed task might look like (and any alternatives considered).
The endpoint takes in a list of courses from a JSON body that is passed in with the post request.

The matchBuddy endpoint needs to:

  • (TBC with user team) Authorize that the user who is sending the request is the user
  • Check that the courses passed in are all valid courses
  • Query the database to get back all students who are in the courses, remove any duplicates, and students who don't want to be paired
  • Get all relevant information of the students returned, and format them into a JSON list to be sent back to the frontend
  • Corresponding response code is returned based on success/failure

Response codes:
200 Ok, with list of possible buddies
204 No Content, if no buddies found
404 Not Found, if courses passed in are not valid
(TBD) 403 not authorized, if the user authentication system is set up (added as a later issue)

Notes

  • Authorization will be confirmed with user team, and added in a later issue
  • Communication team will be consulted in regards to welcome message, added in a later issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.