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

Fix Object Serialization, Proposal to improve Database-Scheme, #62

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

Conversation

JudithWell
Copy link

@JudithWell JudithWell commented Feb 9, 2025

This issue closes #31 (Moritz Gorny, me), #23 (Jonathan Stern), #61(both of us).

These issues were combined because working on them in parallel at the same time was very useful.

#52: Jonathan and I reworked the Database Scheme for more consistent naming, no redundancy and better applicability of Serializer Pattern. See the original issue #52 for context.

#31: Implementing Serializer Pattern for classes that reflect Entities in the database. Motivation: hide the db-backend structure and SQL Queries from domain classes (Course, User, CourseProject).

#23: Creating Course and CourseProject classes

Rework of Database-Scheme

The new scheme has the following tables. No additional tables shall be created sneakily, you can also refer to databaseInitializer.ts for the table definitions.

ER-Diagram

Testing:

The DB changes were rigorously reviewed and checked, but the app has not been tested in its entirety.

UI:

No changes to UI were made. (apart from renaming endpoints etc.)

Fix Object Serialization

Serializer Pattern was implemented.
Interfaces: Reader, Writer, Serializable.
Use DatabaseWriter and DatabaseResultSetReader for reading and writing to/from DB.
To create new entries in the DB use DatabaseSerializableFactory, for getting Objects refer to ObjectHandler. Project Membership is managed in ProjectManager.
For Usage of the Serializer please refer to User class as an example.

There are still some parts of the server to migrate. But I have passed the mark of 40 hours of work on this and feel like this should be good enough for now.

Testing:

The basic reading and writing was tested in the provided serializer.test.ts file.

UI

No UI changes were made.

Creating Course and CourseProject classes

Added the classes.

How can this be tested?

Not very much to test.

Screenshots

No UI changes were made.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

SirJonithan and others added 30 commits January 26, 2025 21:16
…ty far along the way, but reader exists only as a concept for now.
…ctFeatures.ts to keep the old client interface, but use new db scheme under the hood.
… the concept from the actual "model" classes.
…se. Adjusted ObjectHandler to use the Reader where aplicable.
… and written to and from db and entity objects.
@JudithWell JudithWell marked this pull request as ready for review February 10, 2025 07:50
@JudithWell
Copy link
Author

I updated the PR to fix merge conflicts.
Please note that projectManagement apparently got two new methods like "getUserRole()" by someone elses commit, which try to adjust the "role" column in users table. This column does not exist though, roles are user and project specific and thus saved in user_projects table. Our PR offers this functionality in ProjectManager class, which offers getRoleIn() and setRoleIn() methods.

@joluj joluj linked an issue Feb 14, 2025 that may be closed by this pull request
Copy link
Contributor

@joluj joluj left a comment

Choose a reason for hiding this comment

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

Thank you very much for your contribution! The changes are good, however, with many changed there is always much to complain :D The change requests are quite small though, so good job!

Please make sure that you never use any (except for a view exceptions, but those shouldn't apply here).

Please also make sure that you lower the number of linter complaints. It is 18 on the main branch and 23 in yours. That should be solved by removing all of these anys.

newSemester: selectedCourse.semester,
newProjectGroupName: courseName,
courseName: selectedCourse.courseName,
newSemester: selectedCourse.semester, // ToDo remove
Copy link
Contributor

Choose a reason for hiding this comment

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

Who is that todo for?

  • For you: Please fix
  • For others: Please reference the issue ID with the TODO. Create an issue if necessary

Copy link
Author

Choose a reason for hiding this comment

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

@SirJonithan that was your change, please decide what we need to do here.

client/src/components/Projects/CodeActivity.tsx Outdated Show resolved Hide resolved
server/package.json Outdated Show resolved Hide resolved
server/src/Serializer/DatabaseResultSetReader.ts Outdated Show resolved Hide resolved
server/src/Serializer/DatabaseSerializableFactory.ts Outdated Show resolved Hide resolved
server/src/auth.ts Outdated Show resolved Hide resolved
server/src/auth.ts Outdated Show resolved Hide resolved
server/src/auth.ts Outdated Show resolved Hide resolved
server/src/databaseInitializer.ts Outdated Show resolved Hide resolved
server/src/CourseManager.ts Show resolved Hide resolved
@JudithWell
Copy link
Author

I have successfully merged the upstream changes. Please handle the linting errors @SirJonithan and the one remaining requested change regarding your work!

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.

Fix object serialization Add Course and CourseProject classes
3 participants