feat: ajout manual_status et status_history aux réservations
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 18m16s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 18m16s
This commit is contained in:
@@ -21,6 +21,7 @@ func (v Booking) ToStorageType() storage.Booking {
|
||||
Unavailableto: v.Unavailableto.AsTime(),
|
||||
Data: map[string]any{},
|
||||
Deleted: v.Deleted,
|
||||
ManualStatus: v.ManualStatus,
|
||||
}
|
||||
|
||||
for k, d := range v.Data.GetFields() {
|
||||
@@ -38,6 +39,19 @@ func (v Booking) ToStorageType() storage.Booking {
|
||||
booking.Vehicle = v.Vehicle.ToStorageType()
|
||||
}
|
||||
|
||||
for _, entry := range v.StatusHistory {
|
||||
booking.StatusHistory = append(booking.StatusHistory, storage.StatusHistoryEntry{
|
||||
FromStatus: entry.FromStatus,
|
||||
ToStatus: entry.ToStatus,
|
||||
UserID: entry.UserId,
|
||||
UserName: entry.UserName,
|
||||
GroupID: entry.GroupId,
|
||||
GroupName: entry.GroupName,
|
||||
Date: entry.Date.AsTime(),
|
||||
Comment: entry.Comment,
|
||||
})
|
||||
}
|
||||
|
||||
return booking
|
||||
}
|
||||
|
||||
@@ -63,6 +77,20 @@ func BookingFromStorageType(booking *storage.Booking) (*Booking, error) {
|
||||
Unavailableto: timestamppb.New(booking.Unavailableto),
|
||||
Data: data,
|
||||
Deleted: booking.Deleted,
|
||||
ManualStatus: booking.ManualStatus,
|
||||
}
|
||||
|
||||
for _, entry := range booking.StatusHistory {
|
||||
result.StatusHistory = append(result.StatusHistory, &StatusHistoryEntry{
|
||||
FromStatus: entry.FromStatus,
|
||||
ToStatus: entry.ToStatus,
|
||||
UserId: entry.UserID,
|
||||
UserName: entry.UserName,
|
||||
GroupId: entry.GroupID,
|
||||
GroupName: entry.GroupName,
|
||||
Date: timestamppb.New(entry.Date),
|
||||
Comment: entry.Comment,
|
||||
})
|
||||
}
|
||||
|
||||
result.Vehicle, err = VehicleFromStorageType(&booking.Vehicle)
|
||||
|
||||
Reference in New Issue
Block a user