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

Implement Java entity classes for DB integration in Spring project #81

Closed
10 tasks done
melihakpinar opened this issue Apr 27, 2024 · 12 comments
Closed
10 tasks done
Assignees
Labels
Action Item A specific task requiring attention Backend Priority: High Requires taking action ASAP
Milestone

Comments

@melihakpinar
Copy link
Contributor

melihakpinar commented Apr 27, 2024

ℹ️ Description

Create Java classes that will serve as entities in our project's database. These classes will be placed in the models directory of our Spring project.

🎯 Tasks

Develop Java entity classes that correspond to the database schema. Each class should be annotated with Spring's @entity and should include fields, constructors, getters, and setters relevant to the database columns. Look at the ER diagram for attributes. (You can see an example here.)

  • Implement Users class.
  • Implement GuestUsers class.
  • Implement RegisteredUsers class.
  • Implement Followings Class
  • Implement BlockedUsers class.
  • Implement Comments class.
  • Implement Likes class.
  • Implement Dislikes class.
  • Implement Posts class.
  • Implement Tags class.
@melihakpinar melihakpinar added Priority: High Requires taking action ASAP Dependent dependent to other issues Action Item A specific task requiring attention Backend labels Apr 27, 2024
@melihakpinar melihakpinar changed the title Implement Java Entity Classes for Database Integration in Spring Project Implement Java entity classes for DB integration in Spring project Apr 27, 2024
@melihakpinar melihakpinar removed the Dependent dependent to other issues label Apr 27, 2024
@melihakpinar
Copy link
Contributor Author

A friendly reminder that this issue is a blocker of #82.

@OmerFarukBOUN
Copy link
Contributor

I am implementing the users.

@OmerFarukBOUN
Copy link
Contributor

I have implemented the Users but I am not sure if I did it right. @melihakpinar can you review it?

@melihakpinar
Copy link
Contributor Author

I have implemented the Users but I am not sure if I did it right. @melihakpinar can you review it?

Sure thanks, could you please create a pull request to backend branch and add me as a reviewer?

@OmerFarukBOUN
Copy link
Contributor

OmerFarukBOUN commented Apr 27, 2024

I am not able to push it? I don't know why.

@OmerFarukBOUN
Copy link
Contributor

Fixed and pushed.

@bartukonca bartukonca added this to the Milestone 2 milestone Apr 27, 2024
@OmerFarukBOUN
Copy link
Contributor

While implementing like and dislike relations, there are two ways to implement these:

  1. Define likeID: faster to implement and (userID, postID) tuple can be forced to bu not null and unique but we still use another ID.
  2. Define a class which holds userID and postID and define the ID of likes as this class.

Which one should I implement?

@SturmR
Copy link
Contributor

SturmR commented Apr 27, 2024

I’d suggest defining likeID, seems simpler and more flexible.

@OmerFarukBOUN
Copy link
Contributor

We have another problem: We do not want a user to like and dislike a post at the same time. I have 3 suggestions but I do not know which one would be better to implement:

  1. Use triggers in the database for check
  2. Having only one "Reaction" table for like and dislike
  3. Check it in a higher place

I am open for other suggestions too

@OmerFarukBOUN
Copy link
Contributor

I’d suggest defining likeID, seems simpler and more flexible.

I have done some research on it and the articles that I have come across with are doing it with defining a class. @melihakpinar @SturmR @Pqrq what are you thinking about?

@OmerFarukBOUN
Copy link
Contributor

I have realized something, we do not hold special ID's for relations. Which means if we use the id method, we would probably have sql issues :/

@OmerFarukBOUN
Copy link
Contributor

For ease of use in the future, i implement them as classes. Finished all the classes. There is a pending pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Action Item A specific task requiring attention Backend Priority: High Requires taking action ASAP
Projects
None yet
Development

No branches or pull requests

5 participants