@ -16,30 +16,54 @@ type Maybe<T> = { present: false } | { present: true; value: T }
// PostiDM
//
type UserID = string
type BookingID = string
type SlotID = string
type SeatID = string
type RoomID = string
type UserPermission = 'basic' | 'helper' | 'moderator' | 'admin'
type PostiDM = {
users : Map < UserID , User >
rooms : Map < RoomID , Room >
seats : Map < SeatID , Seat >
slots : Map < SlotID , Slot >
getCurrentWeekSlots ( ) : Slot [ ]
bookings : Map < BookingID , Booking >
}
type UserID = string
// TODO: Tutte le funzioni "getCurrentSomething()" in realtà sono da pensare meglio in modo da poter passare un range temporale o qualcosa del genere
/ * *
* Un utente loggato con credenziali di ateneo
* /
type User = {
id : UserID
permissions : Set < UserPermission >
bookings : Booking [ ]
getBookings ( ) : Booking [ ]
getCurrentSeat ( ) : Maybe < Seat >
}
type BookingID = string
/ * *
* Una prenotazione di un utente per un certo slot orario
* /
type Booking = {
id : BookingID
timestamp : Datetime
slotID : SlotID
userID : UserID // cioè ok c'è User.bookings però pensando in SQL è sempre meglio avere comunque un id qui (forse)
getSlot ( ) : Slot // giusto per comodità per parlare direttamente dell'oggetto "Slot" relativo ad un "Booking"
getSeat ( ) : Seat // ".getSlot().getSeat()"
}
type SlotID = string
/ * *
* Slot rappresenta uno slot orario prenotabile per un certo posto
* /
type Slot = {
id : SlotID
seatID : SeatID
@ -47,9 +71,13 @@ type Slot = {
from : Datetime
to : Datetime
}
getCurrentBooking ( ) : Maybe < Booking >
}
type SeatID = string
/ * *
* Seat rappresenta un posto in dipartimento in una certa stanza
* /
type Seat = {
id : SeatID
roomID : RoomID
@ -60,11 +88,13 @@ type Seat = {
height : Natural
}
// non mi piace questo nome
getCurrent Occupant( ) : Maybe < UserID >
// TODO: Forse per ora è meglio fare che più utenti possono prenotare lo stesso posto così inizialmente possiamo fare che in ogni stanza c'è solo un posto e la gente può prenotarsi solo "alla stanza" e non al posto specifico, altrimenti facciamo "getCurrentBookedUser(): Maybe<User>"
getCurrent lyBookedUsers( ) : User [ ]
}
type RoomID = string
/ * *
* Room rappresenta una stanza in dipartimento e contiene dei posti
* /
type Room = {
id : RoomID
seatIDs : SeatID [ ]
@ -73,6 +103,6 @@ type Room = {
gridCols : Natural
}
getTotalSeatCount ( ) : Natural
get Occupi edSeatCount( ) : Natural
getTotalSeatCount ( ) : Natural // ".seatIDs.length"
get CurrentBook edSeatCount( ) : Natural
}