2020-05-10 22:45:36 -06:00
|
|
|
package lila.clas
|
|
|
|
|
|
|
|
import org.joda.time.DateTime
|
|
|
|
|
2021-03-09 04:18:55 -07:00
|
|
|
import lila.user.{ Holder, User }
|
2020-05-10 22:45:36 -06:00
|
|
|
|
|
|
|
case class ClasInvite(
|
|
|
|
_id: ClasInvite.Id, // random
|
|
|
|
userId: User.ID,
|
|
|
|
realName: String,
|
|
|
|
clasId: Clas.Id,
|
|
|
|
created: Clas.Recorded,
|
|
|
|
accepted: Option[Boolean] = None
|
|
|
|
)
|
|
|
|
|
|
|
|
object ClasInvite {
|
|
|
|
|
|
|
|
case class Id(value: String) extends AnyVal with StringValue
|
|
|
|
|
2021-03-09 04:18:55 -07:00
|
|
|
def make(clas: Clas, user: User, realName: String, teacher: Holder) =
|
2020-05-10 22:45:36 -06:00
|
|
|
ClasInvite(
|
2020-08-18 13:31:32 -06:00
|
|
|
_id = Id(lila.common.ThreadLocalRandom nextString 8),
|
2020-05-10 22:45:36 -06:00
|
|
|
userId = user.id,
|
|
|
|
realName = realName,
|
|
|
|
clasId = clas.id,
|
|
|
|
created = Clas.Recorded(by = teacher.id, at = DateTime.now)
|
|
|
|
)
|
|
|
|
|
|
|
|
sealed trait Feedback
|
|
|
|
object Feedback {
|
2020-07-01 02:49:36 -06:00
|
|
|
case object Already extends Feedback
|
|
|
|
case object Invited extends Feedback
|
|
|
|
case object Found extends Feedback
|
|
|
|
case class CantMsgKid(url: String) extends Feedback
|
2020-05-10 22:45:36 -06:00
|
|
|
}
|
|
|
|
}
|