User
The User entity, mapped to the users table.
| Table | users |
| Tenant-scoped | No — global table |
| Columns | 11 |
| Relationships | 2 |
| Source | backend/src/main/java/com/motorph/payroll/model/User.java |
Not tenant-scoped
This entity does not extend TenantOwned, so its rows are shared across every tenant. TenantCoverageTest allows that only for tables deliberately declared global.
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
userId | Integer | user_id | — | primary key, generated |
username | String | username | — | unique |
password | String | password | — | — |
email | String | email | — | unique |
fullName | String | full_name | — | — |
status | String | status | — | — |
tenantId | Integer | tenant_id | Yes | Owning tenant, or null for platform accounts (super admins) that operate across tenants. |
employeeId | Integer | employee_id | Yes | Null for platform accounts, which have no employee record. |
mustChangePassword | boolean | must_change_password | — | Set when provisioning hands out a temporary password rather than an invite link, forcing a change on first login. |
failedLoginAttempts | int | failed_login_attempts | — | — |
lockedUntil | LocalDateTime | locked_until | Yes | — |
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
role | @ManyToOne | Role | role_id | Yes |
additionalRoles | @ManyToMany | Role | — | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| InventoryOrder | createdBy | @ManyToOne |
| ItemPrice | createdBy | @ManyToOne |
| ItemPriceHistory | changedBy | @ManyToOne |
| OrderStage | assignee | @ManyToOne |
| PurchaseReceiving | receivedBy | @ManyToOne |
| RefreshToken | user | @ManyToOne |
| SavedView | user | @ManyToOne |
| ShipmentTracking | updatedBy | @ManyToOne |
| StockTransaction | performedBy | @ManyToOne |
| UserLog | user | @ManyToOne |
| UserNavPreference | user | @OneToOne |
| WarehouseTransfer | performedBy | @ManyToOne |
Neighbourhood
12 of 14 associations shown; the tables above are complete.
Repository
UserRepository
Declared over User with id type Integer. Source: backend/src/main/java/com/motorph/payroll/repository/UserRepository.java
| Method | Returns | Notes |
|---|---|---|
findByUsername(String username) | Optional<User> | derived |
findAllBy() | List<User> | derived |
findAllByTenantId(Integer tenantId) | List<User> | derived |
findWithRolesByUserId(Integer userId) | Optional<User> | derived |
existsByUsernameIgnoreCase(String username) | boolean | derived |
existsByTenantIdIsNull() | boolean | derived |
existsByUsernameIgnoreCaseAndUserIdNot(String username, Integer userId) | boolean | derived |
existsByEmailIgnoreCase(String email) | boolean | derived |
existsByEmailIgnoreCaseAndUserIdNot(String email, Integer userId) | boolean | derived |
existsByRole_RoleId(Integer roleId) | boolean | derived |
existsByAdditionalRoles_RoleId(Integer roleId) | boolean | derived |
findAllByEmployeeId(Integer employeeId) | List<User> | derived |
findAllByEmployeeIdIn(Set<Integer> employeeIds) | List<User> | derived |
Reached by
These controllers hold — directly or through a service they depend on — a repository over User.
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.