Merge branch 'dev' of git.phc.dm.unipi.it:phc/posti-dm into dev
commit
7387307ad9
@ -0,0 +1,78 @@
|
||||
//
|
||||
// Prelude
|
||||
//
|
||||
|
||||
type Natural = number
|
||||
type Integer = number
|
||||
type Rational = [number, number]
|
||||
type Real = number
|
||||
|
||||
type Datetime = string
|
||||
type Time = string
|
||||
|
||||
type Maybe<T> = { present: false } | { present: true; value: T }
|
||||
|
||||
//
|
||||
// PostiDM
|
||||
//
|
||||
|
||||
type UserPermission = 'basic' | 'helper' | 'moderator' | 'admin'
|
||||
|
||||
type PostiDM = {
|
||||
users: Map<UserID, User>
|
||||
rooms: Map<RoomID, Room>
|
||||
seats: Map<SeatID, Seat>
|
||||
slots: Map<SlotID, Slot>
|
||||
}
|
||||
|
||||
type UserID = string
|
||||
type User = {
|
||||
id: UserID
|
||||
permissions: Set<UserPermission>
|
||||
bookings: Booking[]
|
||||
}
|
||||
|
||||
type BookingID = string
|
||||
type Booking = {
|
||||
id: BookingID
|
||||
timestamp: Datetime
|
||||
slotID: SlotID
|
||||
}
|
||||
|
||||
type SlotID = string
|
||||
type Slot = {
|
||||
id: SlotID
|
||||
seatID: SeatID
|
||||
range: {
|
||||
from: Datetime
|
||||
to: Datetime
|
||||
}
|
||||
}
|
||||
|
||||
type SeatID = string
|
||||
type Seat = {
|
||||
id: SeatID
|
||||
roomID: RoomID
|
||||
diagram: {
|
||||
x: Natural
|
||||
y: Natural
|
||||
width: Natural
|
||||
height: Natural
|
||||
}
|
||||
|
||||
// non mi piace questo nome
|
||||
getCurrentOccupant(): Maybe<UserID>
|
||||
}
|
||||
|
||||
type RoomID = string
|
||||
type Room = {
|
||||
id: RoomID
|
||||
seatIDs: SeatID[]
|
||||
diagram: {
|
||||
gridRows: Natural
|
||||
gridCols: Natural
|
||||
}
|
||||
|
||||
getTotalSeatCount(): Natural
|
||||
getOccupiedSeatCount(): Natural
|
||||
}
|
Loading…
Reference in New Issue