Skip to main content

User

The User entity, mapped to the users table.

Tableusers
Tenant-scopedNo — global table
Columns11
Relationships2
Sourcebackend/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​

FieldTypeColumnNullNotes
userIdIntegeruser_id—primary key, generated
usernameStringusername—unique
passwordStringpassword——
emailStringemail—unique
fullNameStringfull_name——
statusStringstatus——
tenantIdIntegertenant_idYesOwning tenant, or null for platform accounts (super admins) that operate across tenants.
employeeIdIntegeremployee_idYesNull for platform accounts, which have no employee record.
mustChangePasswordbooleanmust_change_password—Set when provisioning hands out a temporary password rather than an invite link, forcing a change on first login.
failedLoginAttemptsintfailed_login_attempts——
lockedUntilLocalDateTimelocked_untilYes—

Relationships​

FieldKindTargetJoin columnRequired
role@ManyToOneRolerole_idYes
additionalRoles@ManyToManyRole——

Referenced by​

EntityFieldKind
InventoryOrdercreatedBy@ManyToOne
ItemPricecreatedBy@ManyToOne
ItemPriceHistorychangedBy@ManyToOne
OrderStageassignee@ManyToOne
PurchaseReceivingreceivedBy@ManyToOne
RefreshTokenuser@ManyToOne
SavedViewuser@ManyToOne
ShipmentTrackingupdatedBy@ManyToOne
StockTransactionperformedBy@ManyToOne
UserLoguser@ManyToOne
UserNavPreferenceuser@OneToOne
WarehouseTransferperformedBy@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

MethodReturnsNotes
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)booleanderived
existsByTenantIdIsNull()booleanderived
existsByUsernameIgnoreCaseAndUserIdNot(String username, Integer userId)booleanderived
existsByEmailIgnoreCase(String email)booleanderived
existsByEmailIgnoreCaseAndUserIdNot(String email, Integer userId)booleanderived
existsByRole_RoleId(Integer roleId)booleanderived
existsByAdditionalRoles_RoleId(Integer roleId)booleanderived
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.

ControllerBase pathEndpointsModule
AuditLogController/api/audit-logs1Auth & Identity
AuthController/api/auth5Auth & Identity
ConversationController/api/conversations5Platform Misc
DemoDataController/api/system-admin/demo-data3Billing & Platform
EmployeeController/api/employees9HR
InventoryController/api/inventory38Inventory & Portal
ItemPriceController—6Inventory & Portal
JobOfferController/api/job-offers6Recruitment
NotificationController/api/notifications3Platform Misc
OrderController/api/inventory/orders6Inventory & Portal
PayrollController/api/payroll8Payroll
PortalAdminController/api/portal/admin3Inventory & Portal
PublicSignupController/api/public/signup2Billing & Platform
RecognitionAwardController/api/recognition-awards7HR
RoleController/api/roles6Auth & Identity
SavedViewController/api/saved-views3Platform Misc
UserController/api/users5Auth & Identity
UserNavPreferenceController/api/user-nav-preference3Platform Misc
WarehouseTransferController/api/inventory/transfers2Inventory & Portal
TenantAdminController/api/admin/tenants7Billing & Platform

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/.