Cleaning up our make reservation page and testing everything
This commit is contained in:
		@ -126,3 +126,23 @@ func (m *postgresDBRepo) SearchAvailabilityForAllRooms(start, end time.Time) ([]
 | 
			
		||||
 | 
			
		||||
	return rooms, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetRoomById gets a room by id
 | 
			
		||||
func (m *postgresDBRepo) GetRoomById(id int) (models.Room, error) {
 | 
			
		||||
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
 | 
			
		||||
	defer cancel()
 | 
			
		||||
 | 
			
		||||
	var room models.Room
 | 
			
		||||
	stmt := `select
 | 
			
		||||
                id, room_name, created_at, updated_at
 | 
			
		||||
            from
 | 
			
		||||
                rooms
 | 
			
		||||
            where id = $1`
 | 
			
		||||
 | 
			
		||||
	row := m.DB.QueryRowContext(ctx, stmt, id)
 | 
			
		||||
	err := row.Scan(&room.ID, &room.RoomName, &room.CreatedAt, &room.UpdatedAt)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return room, err
 | 
			
		||||
	}
 | 
			
		||||
	return room, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -12,4 +12,5 @@ type DatabaseRepo interface {
 | 
			
		||||
	InsertRoomRestriction(res models.RoomRestriction) error
 | 
			
		||||
	SearchAvailabilityByDatesByRoomID(start, end time.Time, roomID int) (bool, error)
 | 
			
		||||
	SearchAvailabilityForAllRooms(start, end time.Time) ([]models.Room, error)
 | 
			
		||||
	GetRoomById(id int) (models.Room, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user