fixed #70 + made db script ignore double bookings
Some checks failed
Tests / Run Go Tests (push) Failing after 2m0s

This commit is contained in:
2026-01-17 22:25:25 +01:00
parent 1daf4db167
commit cfd77ae28d
6 changed files with 105 additions and 32 deletions

View File

@@ -128,6 +128,9 @@ func (b *Booking) InsertWithTimestamp() error {
if b.Timestamp.IsZero() {
return b.Insert()
}
if !checkLastBooking(*b) {
return SameBookingError{}
}
stmt, err := DB.Prepare((`INSERT INTO anwesenheit (card_uid, geraet_id, check_in_out, anwesenheit_typ, timestamp) VALUES ($1, $2, $3, $4, $5) RETURNING counter_id`))
if err != nil {
return err