Skip to content

feat: add Department model#5

Merged
0xpritam merged 1 commit into
mainfrom
devin/1780590928-add-department-model
Jun 4, 2026
Merged

feat: add Department model#5
0xpritam merged 1 commit into
mainfrom
devin/1780590928-add-department-model

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Department Sequelize model (backend/src/models/department.js) following the same pattern as user.js:

  • UUID primary key (UUIDV4 default)
  • name — required, notEmpty validator
  • description — optional (allowNull: true)
  • statusENUM('active', 'inactive'), defaults to 'active'
  • timestamps: true

Registered in models/index.js alongside User. Includes a full test suite (department.model.test.js, 17 tests, 100% coverage).

Link to Devin session: https://app.devin.ai/sessions/b08d56b5cecf4545a99acb077c5d872d
Requested by: @0xpritam


Open in Devin Review

Summary by CodeRabbit

Release Notes

  • New Features

    • Backend infrastructure to support department management capabilities has been added.
  • Tests

    • Added comprehensive test suite for department functionality.

- Sequelize model mirroring User.js style
- UUID primary key with UUIDV4 default
- name (required, notEmpty validator)
- description (optional, allows null)
- status (ENUM: active/inactive, defaults to active)
- Registered in models/index.js
- Full test coverage (17 tests)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cace6d95-1224-4b05-ac09-17cc0d93d2f5

📥 Commits

Reviewing files that changed from the base of the PR and between c99de79 and e4a5fc0.

📒 Files selected for processing (3)
  • backend/src/__tests__/department.model.test.js
  • backend/src/models/department.js
  • backend/src/models/index.js

📝 Walkthrough

Walkthrough

This pull request adds a Department model to the backend Sequelize schema. The Department model includes a UUID primary key, required name field with validation, optional description, and a status field restricted to active/inactive states. The model is then integrated into the main models export alongside the existing User model.

Changes

Department Model

Layer / File(s) Summary
Department model definition and tests
backend/src/models/department.js, backend/src/__tests__/department.model.test.js
Department model factory defines UUID id primary key with default, required name with notEmpty validator, optional description STRING, status ENUM with active/inactive values and active default, and timestamps enabled. Jest tests verify factory function export, model class return, table/model naming, and all attribute types, constraints, validators, and enum configurations.
Model wiring and exports
backend/src/models/index.js
Models index is updated to require and export the new Department factory, and User import path is standardized from './User' to './user'.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A department awaits, with timestamps so true,
UUID keys shining, both active and new,
Status enums dancing 'tween states bright,
Sequelize stitches them all up just right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Department model' directly and clearly describes the main change: adding a new Sequelize Department model. It matches the primary objective and is specific and concise.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1780590928-add-department-model

Comment @coderabbitai help to get the list of available commands and usage tips.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@0xpritam
0xpritam merged commit 3505e8a into main Jun 4, 2026
2 checks passed
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.

1 participant