(WEB_PORTAL) The First CRUD Feature in the Admin Page — Employee Management Screen
Overview
We built a screen that lets admins create, update, and delete employee records. This was the first admin-only CRUD screen completed in this project, and it went on to serve as the base pattern for other management screens afterward.
Key Implementation Points
1. List, Update, and Delete APIs
We set up separate APIs for listing, partial updates, and deletion. The list endpoint also returns information admins frequently check, like employee ID, name, role, and leave balance, so that most management tasks can be completed on a single screen without navigating elsewhere.
2. Add/Edit Modal
Rather than navigating to a whole new page, admins can register a new employee or edit existing information directly through a modal.
3. Preventing Self-Deletion
To prevent an admin from accidentally deleting their own currently logged-in account, we disable the delete button itself whenever the target of deletion matches the currently logged-in account.
Retrospective
- Admin screens tend to involve a lot of actions that are hard to undo once a mistake is made, so we came to feel that building in these kinds of safeguards matters more than the feature implementation itself. A constraint that seems trivial, like preventing self-deletion, actually guards against one of the most common accidents in real operation.
- We reused the "list + modal CRUD" pattern established on this screen for other management features afterward, and it saved us from having to rethink the structure each time.