Skip to content

Conversation

@qamarq
Copy link
Member

@qamarq qamarq commented Mar 12, 2025

wersja backendu w elysiajs


Important

Refactor backend to Elysia framework, update frontend for new backend structure, and configure CI, Docker, and environment settings.

  • Backend Refactor:
    • Migrated backend to Elysia framework (src/index.ts, controllers/*, routes/*).
    • Added JWT authentication setup in setups/jwt.ts.
    • Implemented controllers for auth, courses, departments, groups, registrations, schedules, shared, and user.
    • Configured Prisma ORM with prisma/schema.prisma and lib/db.ts.
    • Added email functionality using nodemailer in lib/email.ts.
    • Added USOS client for OAuth in lib/usos/usos-client.ts.
    • Added CI workflow in .github/workflows/backend_v2_ci.yaml.
  • Frontend Updates:
    • Updated auth function in lib/auth/index.ts to support Elysia.
    • Modified actions in actions/plans.ts and actions/user.ts to use Elysia authentication.
    • Updated package.json dependencies for both backend and frontend.
  • Miscellaneous:
    • Added Docker support with Dockerfile and .dockerignore.
    • Configured environment variables in .env.example.
    • Added Prettier configuration in .prettierrc.
    • Updated .gitignore for backend.

This description was created by Ellipsis for 20d20a5. It will automatically update as commits are pushed.

@Solvro Solvro deleted a comment from solvro-coolify bot Mar 18, 2025
@solvro-coolify
Copy link

solvro-coolify bot commented Mar 18, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-03-18 18:08:07 CET

@qamarq qamarq marked this pull request as ready for review March 18, 2025 18:39
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to ab4f0c4 in 3 minutes and 17 seconds

More details
  • Looked at 2363 lines of code in 40 files
  • Skipped 1 files when reviewing.
  • Skipped posting 17 drafted comments based on config settings.
1. backend_v2/lib/usos/usos-client.ts:17
  • Draft comment:
    This appears to be a direct copy of the existing USOS client. Consider reusing the existing implementation instead of duplicating it.

  • function createClient (usos_client.ts)

  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    The comment appears to be correct - this is clearly duplicated code. However, the fact that this is in a backend_v2 directory suggests this may be an intentional rewrite/migration rather than accidental duplication. The v2 suffix implies this is meant to replace the old version. Code duplication during migrations is sometimes necessary as part of a transition strategy.
    I could be wrong about the migration assumption. Maybe this is actually unintentional duplication that should be fixed.
    Even if this isn't a migration, the comment doesn't provide enough value - it just points out the duplication without suggesting how to fix it or considering why it exists. The PR author likely knows about the old version.
    While the comment correctly identifies code duplication, it doesn't provide actionable value given this appears to be in a v2 codebase. The duplication may be intentional as part of a migration strategy.

2. .github/workflows/backend_v2_ci.yaml:8
  • Draft comment:
    Consider refining the path filter instead of using '*' which might trigger CI on unrelated file changes.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    The "" wildcard would indeed trigger the workflow on any file change in the root directory. However, this could be intentional if there are important root-level files (like package.json, tsconfig.json) that affect backend_v2. The comment doesn't provide specific alternative suggestions and requires the author to make judgment calls about what paths are relevant.
    I might be overlooking legitimate reasons for monitoring root directory changes. Also, the current configuration might be preferable for catching all potentially relevant changes rather than missing important ones.
    While the "
    " pattern is broad, it's a valid defensive approach to ensure no important root-level changes are missed, and the tradeoff of occasional unnecessary builds is acceptable for better safety.
    The comment should be deleted as it questions a potentially intentional configuration without providing clear evidence of a problem or specific actionable improvements.
3. backend_v2/controllers/user-controller.ts:9
  • Draft comment:
    Error log refers to 'getDepartments' which seems to be a copy-paste mistake; update it to reflect 'getUser'.
  • Reason this comment was not posted:
    Marked as duplicate.
4. backend_v2/routes/user-otp.ts:18
  • Draft comment:
    Remove commented-out rateLimit code before merging to keep the codebase clean.
  • Reason this comment was not posted:
    Marked as duplicate.
5. frontend/src/lib/auth/index.ts:207
  • Draft comment:
    Ensure to check for null before iterating over response.headers.getSetCookie() to avoid runtime errors.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. backend_v2/controllers/groups-controller.ts:48
  • Draft comment:
    Incorrect error log message. It logs 'getDepartments' instead of 'getGroups'.
  • Reason this comment was not posted:
    Marked as duplicate.
7. backend_v2/src/index.ts:36
  • Draft comment:
    Cron job for notifications logs '🚀 ~ cron ~ scraper'; update the log message to reflect notifications.
  • Reason this comment was not posted:
    Marked as duplicate.
8. frontend/src/lib/auth/index.ts:207
  • Draft comment:
    Ensure that 'response.headers.getSetCookie()' is supported in your runtime; consider a fallback for environments where this API is unavailable.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. backend_v2/controllers/groups-controller.ts:48
  • Draft comment:
    Typographical error: The console.log message in the catch block of getGroups (line 48) incorrectly references 'getDepartments'. Consider updating it to 'getGroups' to match the function context.
  • Reason this comment was not posted:
    Marked as duplicate.
10. backend_v2/controllers/groups-controller.ts:114
  • Draft comment:
    Typographical error: The console.log message in the catch block of getGroupsById (line 114) incorrectly references 'getDepartments'. Consider updating it to 'getGroupsById' to better reflect the function's context.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    While this is technically correct, error logging messages are primarily for debugging purposes and don't affect functionality. The rules state we should only keep comments that require clear code changes and are important. This is a very minor issue that doesn't impact code behavior or maintainability significantly.
    The error message could potentially confuse developers during debugging. Also, if there's a systematic copy-paste issue, it might indicate a larger problem.
    While debugging might be slightly affected, the stack trace will still show the correct function, and the error object will still be logged correctly. The benefit of fixing this is minimal.
    This comment, while technically correct, addresses a very minor logging message issue that doesn't significantly impact code quality or functionality. It should be removed.
11. backend_v2/controllers/registrations-controller.ts:23
  • Draft comment:
    Typographical error: The log message on line 23 says 'getDepartments' but it's inside the getRegistrations function. Consider updating it to reflect the correct function name for clarity.
  • Reason this comment was not posted:
    Marked as duplicate.
12. backend_v2/controllers/registrations-controller.ts:55
  • Draft comment:
    Typographical error: The error log on line 55 still prints 'getDepartments' even though it's inside the getRegistrationById function. Please update the log statement to reflect the appropriate function name.
  • Reason this comment was not posted:
    Marked as duplicate.
13. backend_v2/controllers/user-controller.ts:9
  • Draft comment:
    Typo: The error log on line 9 references 'getDepartments' instead of 'getUser'. Please update it for consistency.
  • Reason this comment was not posted:
    Marked as duplicate.
14. backend_v2/routes/user.ts:54
  • Draft comment:
    It appears there's a typographical error in the message at line 54. 'Testsss' likely should be corrected to 'Test' or another intended message.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    This is a test endpoint that likely exists just for basic connectivity testing. The exact message content is not important for functionality. This seems like an extremely minor cosmetic issue that doesn't impact the code's behavior. The rules specifically say not to make comments that are obvious or unimportant.
    Maybe having consistent and professional-looking messages even in test endpoints is important for code quality? The typo could confuse other developers.
    The message is in a test endpoint that's likely only used for development. The exact wording has no functional impact and fixing it provides negligible value.
    This comment should be deleted as it points out an extremely minor cosmetic issue in a test endpoint that doesn't meaningfully impact code quality or functionality.
15. backend_v2/src/index.ts:36
  • Draft comment:
    Typo: In the notifications cron block (line 36), the log message incorrectly references 'scraper' instead of 'notifications'. Please update the log message for accuracy.
  • Reason this comment was not posted:
    Marked as duplicate.
16. frontend/src/app/plans/edit/[id]/page.client.tsx:308
  • Draft comment:
    Typographical error: In the DialogDescription text, "Możesz udostępnij link..." should be corrected to "Możesz udostępnić link..." for proper grammar.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
17. frontend/src/app/plans/edit/[id]/page.client.tsx:278
  • Draft comment:
    Typographical error: The parameter name 'groupdId' appears to be misspelled. Consider renaming it to 'groupId' for clarity and consistency. This occurs in multiple onSelectGroup callbacks.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_YHl5dpUxs7kET3yr


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

}

export const usersOtp = new Elysia({ prefix: '/otp' })
// .use(
Copy link

Choose a reason for hiding this comment

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

Consider enabling rate limiting on OTP endpoints to prevent abuse.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 516e0d8 in 1 minute and 13 seconds

More details
  • Looked at 95 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 11 drafted comments based on config settings.
1. backend_v2/.env.example:7
  • Draft comment:
    Removed POLWRO variables. Ensure no dependencies are still referencing these environment variables.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. backend_v2/controllers/groups-controller.ts:48
  • Draft comment:
    Updated error log message improves clarity. Consider using a structured logging approach for consistency.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50%
    None
3. backend_v2/src/index.ts:12
  • Draft comment:
    Using process.env.CORS_ORIGIN split by comma is fine, but verify that the environment variable is provided in a comma-separated format. Consider a fallback for development if missing.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
4. backend_v2/.env.example:10
  • Draft comment:
    Removed unused POLWRO_* env vars; ensure deployment configs are updated.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
5. backend_v2/controllers/groups-controller.ts:48
  • Draft comment:
    Updated error log to use correct method name 'getGroups'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
6. backend_v2/controllers/groups-controller.ts:114
  • Draft comment:
    Updated error log label to 'getGroupsById'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
7. backend_v2/controllers/registrations-controller.ts:23
  • Draft comment:
    Renamed error log to 'getRegistrations' to match the method.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
8. backend_v2/controllers/registrations-controller.ts:55
  • Draft comment:
    Renamed error log to 'getRegistrationById' for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
9. backend_v2/controllers/user-controller.ts:9
  • Draft comment:
    Updated error log to correctly reflect 'getUser'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
10. backend_v2/src/index.ts:12
  • Draft comment:
    Using process.env.CORS_ORIGIN for dynamic CORS setup; confirm localhost is included if needed.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
11. backend_v2/src/index.ts:38
  • Draft comment:
    Fixed typo in notifications cron log; now correctly logs 'notifications'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None

Workflow ID: wflow_AtwbKFMgf2kadkvg


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on adad34f in 31 seconds

More details
  • Looked at 20 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. backend_v2/controllers/auth-controller.ts:90
  • Draft comment:
    Good job using the imported error helper, but verify that logging the raw error (err) doesn't expose sensitive details in production.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. backend_v2/controllers/auth-controller.ts:90
  • Draft comment:
    Good change: Renaming the catch parameter from 'error' to 'err' avoids shadowing the imported error function. Returning a sanitized error response improves security.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None

Workflow ID: wflow_FzxdtRgtp2Xh0r3L


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 20d20a5 in 30 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/package.json:53
  • Draft comment:
    Bump Next.js version updated from 15.1.7 to 15.2.3. Ensure compatibility with any new changes in Next.js and update any related config if needed.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. frontend/package.json:53
  • Draft comment:
    Next.js version bumped to ^15.2.3. Verify compatibility with current features.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. frontend/package.json:2
  • Draft comment:
    Typo detected: The package.json file's "name" field is set to "web-planner", which doesn't match the repository name "web-planer". Please confirm the intended name and correct it if necessary.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_4nyZd1uTluziEvDa


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants