CHANGE: added Cors
This commit is contained in:
@@ -16,9 +16,9 @@ func (e SameBookingError) Error() string {
|
||||
}
|
||||
|
||||
type Booking struct {
|
||||
CardID string `json:"cradID"`
|
||||
CardID string `json:"cardID"`
|
||||
ReaderID string `json:"readerID"`
|
||||
BookingType int `json:"bookingTyp"`
|
||||
BookingType int `json:"bookingType"`
|
||||
LoggedTime time.Time `json:"loggedTime"`
|
||||
Id int `json:"id"`
|
||||
}
|
||||
@@ -123,6 +123,18 @@ func (b Booking) Save() {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Booking) Update(nb Booking) {
|
||||
if b.BookingType != nb.BookingType && nb.BookingType != 0 {
|
||||
b.BookingType = nb.BookingType
|
||||
}
|
||||
if b.CardID != nb.CardID && nb.CardID != "" {
|
||||
b.CardID = nb.CardID
|
||||
}
|
||||
if b.ReaderID != nb.ReaderID && nb.ReaderID != "" {
|
||||
b.ReaderID = nb.ReaderID
|
||||
}
|
||||
}
|
||||
|
||||
func checkLastBooking(b Booking) bool {
|
||||
var booking_type int
|
||||
stmt, err := DB.Prepare((`SELECT booking_type FROM "zeiten" WHERE "card_id" = $1 ORDER BY "logged_time" DESC LIMIT 1;`))
|
||||
|
||||
Reference in New Issue
Block a user