Reworking a bit and finalizing basic models.
All checks were successful
/ Build and Test Application Snapshot (pull_request) Successful in 1m42s
All checks were successful
/ Build and Test Application Snapshot (pull_request) Successful in 1m42s
This commit is contained in:
parent
d79d08dd68
commit
43abd31ede
5 changed files with 94 additions and 71 deletions
|
@ -13,11 +13,14 @@ import gs.uuid.v0.UUID
|
||||||
* The unique slug for the group.
|
* The unique slug for the group.
|
||||||
* @param createdAt
|
* @param createdAt
|
||||||
* The instant at which this group was created.
|
* The instant at which this group was created.
|
||||||
|
* @param createdBy
|
||||||
|
* The unique identifier of the user who created this group.
|
||||||
*/
|
*/
|
||||||
case class Group(
|
case class Group(
|
||||||
id: Group.Id,
|
id: Group.Id,
|
||||||
slug: Slug,
|
slug: Slug,
|
||||||
createdAt: CreatedAt
|
createdAt: CreatedAt,
|
||||||
|
createdBy: CreatedBy
|
||||||
)
|
)
|
||||||
|
|
||||||
object Group:
|
object Group:
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package gs.smolban.model
|
|
||||||
|
|
||||||
import java.time.Instant
|
|
||||||
|
|
||||||
/** Enumeration that describes the status of a [[Ticket]] in Smolban. Smolban
|
|
||||||
* does not yet support custom status/workflow.
|
|
||||||
*/
|
|
||||||
sealed trait Status:
|
|
||||||
def name: String
|
|
||||||
def enteredAt: Instant
|
|
||||||
|
|
||||||
object Status:
|
|
||||||
|
|
||||||
/** This ticket is new, and ready to be started. New tickets may be put into
|
|
||||||
* progress or canceled.
|
|
||||||
*/
|
|
||||||
case class Ready(enteredAt: Instant) extends Status:
|
|
||||||
val name: String = "ready"
|
|
||||||
|
|
||||||
/** This ticket is being worked on actively. In progress tickets can be
|
|
||||||
* paused, completed, or canceled.
|
|
||||||
*/
|
|
||||||
case class InProgress(enteredAt: Instant) extends Status:
|
|
||||||
val name: String = "in_progress"
|
|
||||||
|
|
||||||
/** This ticket was being worked on, but was temporarily stopped. Paused
|
|
||||||
* tickets may be put into progress or canceled.
|
|
||||||
*/
|
|
||||||
case class Paused(enteredAt: Instant) extends Status:
|
|
||||||
val name: String = "paused"
|
|
||||||
|
|
||||||
/** This ticket was driven to completion. The work is done. Once in this
|
|
||||||
* state, the status may no longer change.
|
|
||||||
*/
|
|
||||||
case class Complete(enteredAt: Instant) extends Status:
|
|
||||||
val name: String = "complete"
|
|
||||||
|
|
||||||
/** This ticket was canceled for some reason. Once in this state, the status
|
|
||||||
* may no longer change.
|
|
||||||
*/
|
|
||||||
case class Canceled(enteredAt: Instant) extends Status:
|
|
||||||
val name: String = "canceled"
|
|
||||||
|
|
||||||
end Status
|
|
|
@ -1,6 +1,8 @@
|
||||||
package gs.smolban.model
|
package gs.smolban.model
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
|
import gs.smolban.model.users.User
|
||||||
|
import java.time.Instant
|
||||||
|
|
||||||
/** Tickets represent some tracked work.
|
/** Tickets represent some tracked work.
|
||||||
*
|
*
|
||||||
|
@ -19,9 +21,11 @@ import cats.Show
|
||||||
* @param tags
|
* @param tags
|
||||||
* List of [[Tag]] applied to this ticket.
|
* List of [[Tag]] applied to this ticket.
|
||||||
* @param status
|
* @param status
|
||||||
* Current [[Status]] of this ticket.
|
* Current [[Ticket.Status]] of this ticket.
|
||||||
* @param statusHistory
|
* @param statusHistory
|
||||||
* Linear history of this ticket in terms of status changes.
|
* Linear history of this ticket in terms of status changes.
|
||||||
|
* @param assignee
|
||||||
|
* If set, this ticket is assigned to a specific user.
|
||||||
*/
|
*/
|
||||||
case class Ticket(
|
case class Ticket(
|
||||||
id: Ticket.Id,
|
id: Ticket.Id,
|
||||||
|
@ -31,8 +35,9 @@ case class Ticket(
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
tags: List[Tag],
|
tags: List[Tag],
|
||||||
status: Status,
|
status: Ticket.Status,
|
||||||
statusHistory: List[Status]
|
statusHistory: List[(Ticket.Status, Instant)],
|
||||||
|
assignee: Option[User.Id]
|
||||||
)
|
)
|
||||||
|
|
||||||
object Ticket:
|
object Ticket:
|
||||||
|
@ -68,4 +73,47 @@ object Ticket:
|
||||||
|
|
||||||
end Id
|
end Id
|
||||||
|
|
||||||
|
/** Enumeration that describes the status of a [[Ticket]] in Smolban. Smolban
|
||||||
|
* does not yet support custom status/workflow.
|
||||||
|
*/
|
||||||
|
sealed abstract class Status(val name: String)
|
||||||
|
|
||||||
|
object Status:
|
||||||
|
|
||||||
|
given CanEqual[Status, Status] = CanEqual.derived
|
||||||
|
|
||||||
|
given Show[Status] = _.name
|
||||||
|
|
||||||
|
/** This ticket is new, and ready to be started. New tickets may be put into
|
||||||
|
* progress or canceled.
|
||||||
|
*/
|
||||||
|
case object Ready extends Status("ready")
|
||||||
|
|
||||||
|
/** This ticket is being worked on actively. In progress tickets can be
|
||||||
|
* paused, completed, or canceled.
|
||||||
|
*/
|
||||||
|
case object InProgress extends Status("in_progress")
|
||||||
|
|
||||||
|
/** This ticket was being worked on, but was temporarily stopped. Paused
|
||||||
|
* tickets may be put into progress or canceled.
|
||||||
|
*/
|
||||||
|
case object Paused extends Status("paused")
|
||||||
|
|
||||||
|
/** This ticket was driven to completion. The work is done. Once in this
|
||||||
|
* state, the status may no longer change.
|
||||||
|
*/
|
||||||
|
case object Complete extends Status("complete")
|
||||||
|
|
||||||
|
/** This ticket was canceled for some reason. Once in this state, the status
|
||||||
|
* may no longer change.
|
||||||
|
*/
|
||||||
|
case object Canceled extends Status("canceled")
|
||||||
|
|
||||||
|
val All: List[Status] = List(Ready, InProgress, Paused, Complete, Canceled)
|
||||||
|
|
||||||
|
def parse(candidate: String): Option[Status] =
|
||||||
|
All.find(_.name.equalsIgnoreCase(candidate))
|
||||||
|
|
||||||
|
end Status
|
||||||
|
|
||||||
end Ticket
|
end Ticket
|
||||||
|
|
|
@ -12,17 +12,20 @@ import gs.uuid.v0.UUID
|
||||||
* The instant at which this user was created.
|
* The instant at which this user was created.
|
||||||
* @param username
|
* @param username
|
||||||
* The (unique) [[Username]] of this user.
|
* The (unique) [[Username]] of this user.
|
||||||
* @param userType
|
* @param designation
|
||||||
* The [[UserType]] of this user.
|
* The [[User.Designation]] of this user.
|
||||||
* @param roles
|
* @param roles
|
||||||
* List of [[Role]] assigned to this user.
|
* List of [[Role]] assigned to this user.
|
||||||
|
* @param status
|
||||||
|
* The current [[User.Status]] of this user.
|
||||||
*/
|
*/
|
||||||
case class User(
|
case class User(
|
||||||
id: User.Id,
|
id: User.Id,
|
||||||
createdAt: CreatedAt,
|
createdAt: CreatedAt,
|
||||||
username: Username,
|
username: Username,
|
||||||
userType: UserType,
|
designation: User.Designation,
|
||||||
roles: List[Role]
|
roles: List[Role],
|
||||||
|
status: User.Status
|
||||||
)
|
)
|
||||||
|
|
||||||
object User:
|
object User:
|
||||||
|
@ -58,4 +61,36 @@ object User:
|
||||||
|
|
||||||
end Id
|
end Id
|
||||||
|
|
||||||
|
/** Enumeration that describes the designation of a [[User]].
|
||||||
|
*/
|
||||||
|
sealed abstract class Designation(val name: String)
|
||||||
|
|
||||||
|
object Designation:
|
||||||
|
|
||||||
|
/** Regular users are typically human, and are expected to be using the Web
|
||||||
|
* UI and _possibly_ APIs.
|
||||||
|
*/
|
||||||
|
case object Regular extends Designation("regular")
|
||||||
|
|
||||||
|
/** Service users are intended for use by API-consuming services. They are
|
||||||
|
* not suitable for human/UI interactive use.
|
||||||
|
*/
|
||||||
|
case object Service extends Designation("service")
|
||||||
|
|
||||||
|
end Designation
|
||||||
|
|
||||||
|
/** Enumeration that describes the status of a [[User]] in Smolban.
|
||||||
|
*/
|
||||||
|
sealed abstract class Status(val name: String)
|
||||||
|
|
||||||
|
object Status:
|
||||||
|
|
||||||
|
given CanEqual[Status, Status] = CanEqual.derived
|
||||||
|
|
||||||
|
given Show[Status] = _.name
|
||||||
|
|
||||||
|
case object Active extends Status("active")
|
||||||
|
case object Suspended extends Status("suspended")
|
||||||
|
case object Off extends Status("off")
|
||||||
|
|
||||||
end User
|
end User
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package gs.smolban.model.users
|
|
||||||
|
|
||||||
/** Enumeration that describes the type of a [[User]].
|
|
||||||
*/
|
|
||||||
sealed abstract class UserType(val name: String)
|
|
||||||
|
|
||||||
object UserType:
|
|
||||||
|
|
||||||
/** Regular users are typically human, and are expected to be using the Web UI
|
|
||||||
* and _possibly_ APIs.
|
|
||||||
*/
|
|
||||||
case object Regular extends UserType("regular")
|
|
||||||
|
|
||||||
/** Service users are intended for use by API-consuming services. They are not
|
|
||||||
* suitable for human/UI interactive use.
|
|
||||||
*/
|
|
||||||
case object Service extends UserType("service")
|
|
||||||
|
|
||||||
end UserType
|
|
Loading…
Add table
Reference in a new issue