Initial commit
This commit is contained in:
commit
1919e4b72c
14 changed files with 640 additions and 0 deletions
20
model/src/lu/foyer/clients/Address.scala
Normal file
20
model/src/lu/foyer/clients/Address.scala
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package lu.foyer
|
||||
package clients
|
||||
|
||||
import zio.schema.*
|
||||
|
||||
opaque type AddressStreet <: String = String
|
||||
object AddressStreet extends NonBlankString[AddressStreet]
|
||||
|
||||
opaque type AddressPostalCode <: String = String
|
||||
object AddressPostalCode extends NonBlankString[AddressPostalCode]
|
||||
|
||||
opaque type AddressLocality <: String = String
|
||||
object AddressLocality extends NonBlankString[AddressLocality]
|
||||
|
||||
case class Address(
|
||||
street: AddressStreet,
|
||||
postalCode: AddressPostalCode,
|
||||
locality: AddressLocality,
|
||||
country: Country)
|
||||
derives Schema
|
||||
49
model/src/lu/foyer/clients/Client.scala
Normal file
49
model/src/lu/foyer/clients/Client.scala
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package lu.foyer
|
||||
package clients
|
||||
|
||||
import zio.schema.*
|
||||
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
|
||||
opaque type ClientLastName <: String = String
|
||||
object ClientLastName extends NonBlankString[ClientLastName]
|
||||
|
||||
opaque type ClientFirstName <: String = String
|
||||
object ClientFirstName extends NonBlankString[ClientFirstName]
|
||||
|
||||
opaque type ClientBirthDate <: LocalDate = LocalDate
|
||||
object ClientBirthDate extends RefinedLocalDate[ClientBirthDate]
|
||||
|
||||
opaque type ClientDrivingLicenseDate <: LocalDate = LocalDate
|
||||
object ClientDrivingLicenseDate extends RefinedLocalDate[ClientDrivingLicenseDate]
|
||||
|
||||
opaque type Email <: String = String
|
||||
object Email extends NonBlankString[Email]
|
||||
|
||||
opaque type NationalNumber <: String = String
|
||||
object NationalNumber extends NonBlankString[NationalNumber]
|
||||
|
||||
case class Client(
|
||||
lastName: ClientFirstName,
|
||||
firstName: ClientLastName,
|
||||
drivingLicenseDate: ClientDrivingLicenseDate,
|
||||
phoneNumber: PhoneNumber,
|
||||
email: Email,
|
||||
address: Address)
|
||||
derives Schema
|
||||
|
||||
// TODO validate using libphonenumber
|
||||
case class PhoneNumber(
|
||||
country: Country,
|
||||
nationalNumber: NationalNumber,
|
||||
lastVerifiedAt: Option[Instant])
|
||||
derives Schema
|
||||
|
||||
case class PhoneNumberInput(
|
||||
country: Country,
|
||||
nationalNumber: String)
|
||||
derives Schema
|
||||
|
||||
enum ClientDisabledReason derives Schema:
|
||||
case GDPR, Death
|
||||
7
model/src/lu/foyer/clients/Country.scala
Normal file
7
model/src/lu/foyer/clients/Country.scala
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package lu.foyer
|
||||
package clients
|
||||
|
||||
import zio.schema.*
|
||||
|
||||
enum Country derives Schema:
|
||||
case LU, FR, BE
|
||||
Loading…
Add table
Add a link
Reference in a new issue