// // Common // export type CommonProps = 'id' | 'createdAt' type Opaque = T & { _: K; __: L } type Id = Opaque // // Users // export type AdministratorRole = 'admin' | 'moderator' export type StudentRole = 'student' export type UserRole = AdministratorRole | StudentRole export type UserId = Id export type User = { id: UserId role: UserRole } export function isAdministrator(role: UserRole): role is AdministratorRole { return role !== 'student' } export function isStudent(role: UserRole): role is StudentRole { return role === 'student' } // // Problems // export type ProblemId = Id export type Problem = { id: ProblemId content: string createdBy: UserId createdAt: string } // // Solutions // export type SolutionStatus = 'pending' | 'rejected' | 'accepted' export type SolutionId = string export type Solution = { id: SolutionId sentBy: UserId forProblem: ProblemId content: string status: SolutionStatus }