feat(01-03): create Repository pattern with typed errors
- Add User domain model (summer_users table mapping) - Add RepositoryError ADT (NotFound, Conflict, ValidationError, DatabaseError) - Implement UserRepository trait with CRUD operations - Add UserRepositoryLive using Quill with compile-time SQL validation - Handle SQL exceptions with refineOrDie for typed error channel
This commit is contained in:
26
summercms/src/model/User.scala
Normal file
26
summercms/src/model/User.scala
Normal file
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
import java.time.Instant
|
||||
|
||||
/** User domain model
|
||||
*
|
||||
* Represents a registered user in the system. Maps to the summer_users table.
|
||||
*
|
||||
* @param id
|
||||
* Auto-generated primary key
|
||||
* @param email
|
||||
* Unique email address, used for login
|
||||
* @param passwordHash
|
||||
* Bcrypt-hashed password (never store plain text)
|
||||
* @param createdAt
|
||||
* Timestamp when user was created
|
||||
* @param updatedAt
|
||||
* Timestamp of last update
|
||||
*/
|
||||
case class User(
|
||||
id: Long,
|
||||
email: String,
|
||||
passwordHash: String,
|
||||
createdAt: Instant,
|
||||
updatedAt: Instant
|
||||
)
|
||||
Reference in New Issue
Block a user