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

Kevin Du - Project Checkpoint 3 #114

Open
4 tasks done
DasMoge124 opened this issue May 28, 2024 · 0 comments
Open
4 tasks done

Kevin Du - Project Checkpoint 3 #114

DasMoge124 opened this issue May 28, 2024 · 0 comments

Comments

@DasMoge124
Copy link
Collaborator

DasMoge124 commented May 28, 2024

My Demonstration for my features

Links:
Sign Up
Class Creation Feature

My checklist:

  • Backend: New Attributes for the Person Class (5/23)
@ElementCollection(fetch = FetchType.EAGER)
    @CollectionTable(name = "person_subjects", joinColumns = @JoinColumn(name = "person_id"))
    @Column(name = "subject")
    private Collection<String> subjectsOfInterest = new ArrayList<>();
  • Frontend: Sign Up Page (5/25)
  • Backend: Connect the new users generated after they sign up to the database (5/26)
@PostMapping("/post")
    public ResponseEntity<Object> postPerson(@RequestBody PersonRequest personRequest) {
        // A person object WITHOUT ID will create a new record with default roles as
        // student
        Person person = new Person(personRequest.getEmail(), personRequest.getPassword(), personRequest.getName(),
                personRequest.getUsn(), personRequest.getSubjectsOfInterest());
        personDetailsService.save(person);
        return new ResponseEntity<>(personRequest.getEmail() + " is created successfully", HttpStatus.CREATED);
    }
  • Backend: Implement searching into the class creation feature based on subjects. (5/27)
    Uses a SQL query to get the subjects of interest
  // List<Person> findBySubjectsOfInterestContainingIgnoreCase(String subjectOfInterest);
  // CUSTOM QUERY METHOD TO GET A SUBJECT OF INTEREST
    @Query("SELECT p FROM Person p JOIN p.subjectsOfInterest s WHERE LOWER(s) = LOWER(:subjectOfInterest)")
    List<Person> findBySubjectOfInterestIgnoreCase(@Param("subjectOfInterest") String subjectOfInterest);

@GetMapping("/getBySubject/{subjectOfInterest}")
    public ResponseEntity<?> getPersonsBySubject(@PathVariable String subjectOfInterest) {
        List<Person> personList = personDetailsService.getPersonsBySubjectOfInterest(subjectOfInterest);
        // regardless of outcome, even if it's an empty list, it's still a valid output
        return new ResponseEntity<>(personList, HttpStatus.OK);
    }

Undo and Redo Stacks and Queues:

image
image

  • I tried to use backend for this method, but it didn't work out well so I have frontend
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

No branches or pull requests

1 participant