Search in sources :

Example 16 with EventAndOrganizationId

use of alfio.model.EventAndOrganizationId in project alf.io by alfio-event.

the class AdminReservationRequestRepository method insertRequest.

default void insertRequest(String requestId, long userId, EventAndOrganizationId event, Stream<AdminReservationModification> requestModifications) {
    MapSqlParameterSource[] requests = requestModifications.map(res -> new MapSqlParameterSource("userId", userId).addValue("requestId", requestId).addValue("requestType", AdminReservationRequest.RequestType.IMPORT.name()).addValue("status", AdminReservationRequest.Status.PENDING.name()).addValue("eventId", event.getId()).addValue("body", Json.toJson(res))).toArray(MapSqlParameterSource[]::new);
    getNamedParameterJdbcTemplate().batchUpdate("insert into admin_reservation_request(user_id, request_id, event_id, request_type, status, body) values(:userId, :requestId, :eventId, :requestType, :status, :body)", requests);
}
Also used : Bind(ch.digitalfondue.npjt.Bind) AdminReservationRequest(alfio.model.AdminReservationRequest) QueryRepository(ch.digitalfondue.npjt.QueryRepository) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Json(alfio.util.Json) List(java.util.List) Stream(java.util.stream.Stream) Query(ch.digitalfondue.npjt.Query) EventAndOrganizationId(alfio.model.EventAndOrganizationId) Optional(java.util.Optional) AdminReservationModification(alfio.model.modification.AdminReservationModification) AdminReservationRequestStats(alfio.model.AdminReservationRequestStats) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Aggregations

EventAndOrganizationId (alfio.model.EventAndOrganizationId)16 User (alfio.model.user.User)5 Json (alfio.util.Json)3 Test (org.junit.jupiter.api.Test)3 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)3 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)3 Ticket (alfio.model.Ticket)2 PollModification (alfio.model.modification.PollModification)2 PollOptionModification (alfio.model.modification.PollOptionModification)2 alfio.model.poll (alfio.model.poll)2 ErrorCode (alfio.model.result.ErrorCode)2 Result (alfio.model.result.Result)2 alfio.repository (alfio.repository)2 PinGenerator (alfio.util.PinGenerator)2 java.util (java.util)2 Objects.requireNonNullElse (java.util.Objects.requireNonNullElse)2 Collectors (java.util.stream.Collectors)2 Collectors.toList (java.util.stream.Collectors.toList)2 IntStream (java.util.stream.IntStream)2 AllArgsConstructor (lombok.AllArgsConstructor)2