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:
Jakub Zych
2026-02-04 22:41:11 +01:00
parent d2399de260
commit 12e738f1b5
3 changed files with 237 additions and 0 deletions

View 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
)