diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/event/Event.java b/application/src/main/java/net/furizon/backend/feature/pretix/event/Event.java index dcbafa8c..69c23af6 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/event/Event.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/event/Event.java @@ -1,5 +1,6 @@ package net.furizon.backend.feature.pretix.event; +import com.google.common.hash.Hashing; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -8,6 +9,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Map; @@ -33,11 +35,16 @@ public class Event { @Nullable private Map eventNames; + public int getId() { + return Hashing.sha512().hashString(slug, StandardCharsets.UTF_8).asInt(); + } + public static class EventBuilder { public EventBuilder slug(String fullSlug) { this.slug = fullSlug; return this; } + public EventBuilder slug(String eventSlug, String organizerSlug) { this.slug = PretixGenericUtils.buildOrgEventSlug(eventSlug, organizerSlug); return this; diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/event/action/insert/JooqInsertNewEventAction.java b/application/src/main/java/net/furizon/backend/feature/pretix/event/action/insert/JooqInsertNewEventAction.java index af3e950e..e93d0acf 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/event/action/insert/JooqInsertNewEventAction.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/event/action/insert/JooqInsertNewEventAction.java @@ -1,5 +1,6 @@ package net.furizon.backend.feature.pretix.event.action.insert; +import com.google.common.hash.Hashing; import lombok.RequiredArgsConstructor; import net.furizon.backend.feature.pretix.event.Event; import net.furizon.backend.infrastructure.jackson.JsonSerializer; @@ -8,6 +9,7 @@ import org.jooq.util.postgres.PostgresDSL; import org.springframework.stereotype.Component; +import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Optional; @@ -26,28 +28,24 @@ public void invoke(@NotNull Event event) { PostgresDSL .insertInto( EVENTS, + EVENTS.ID, EVENTS.EVENT_SLUG, EVENTS.EVENT_DATE_TO, EVENTS.EVENT_DATE_FROM, EVENTS.EVENT_IS_CURRENT, EVENTS.EVENT_PUBLIC_URL, - EVENTS.EVENT_NAMES + EVENTS.EVENT_NAMES_JSON ) .values( + event.getId(), event.getSlug(), - Optional - .ofNullable(event.getDateTo()) - .map(OffsetDateTime::toString) - .orElse(null), - Optional - .ofNullable(event.getDateFrom()) - .map(OffsetDateTime::toString) - .orElse(null), + event.getDateTo(), + event.getDateFrom(), event.isCurrent(), event.getPublicUrl(), Optional .ofNullable(event.getEventNames()) - .map(jsonSerializer::serializeAsString) + .map(jsonSerializer::serializeAsJson) .orElse(null) ) ); diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/event/action/update/JooqUpdateEventAction.java b/application/src/main/java/net/furizon/backend/feature/pretix/event/action/update/JooqUpdateEventAction.java index 732e3074..86ece188 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/event/action/update/JooqUpdateEventAction.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/event/action/update/JooqUpdateEventAction.java @@ -25,21 +25,15 @@ public void invoke(@NotNull final Event event) { command.execute( PostgresDSL .update(EVENTS) - .set(EVENTS.EVENT_DATE_FROM, Optional - .ofNullable(event.getDateFrom()) - .map(OffsetDateTime::toString) - .orElse(null)) + .set(EVENTS.EVENT_DATE_FROM, event.getDateFrom()) .set(EVENTS.EVENT_IS_CURRENT, event.isCurrent()) .set(EVENTS.EVENT_PUBLIC_URL, event.getPublicUrl()) - .set(EVENTS.EVENT_NAMES, Optional + .set(EVENTS.EVENT_NAMES_JSON, Optional .ofNullable(event.getEventNames()) - .map(jsonSerializer::serializeAsString) - .orElse(null)) - .set(EVENTS.EVENT_DATE_TO, Optional - .ofNullable(event.getDateTo()) - .map(OffsetDateTime::toString) + .map(jsonSerializer::serializeAsJson) .orElse(null)) - .where(EVENTS.EVENT_SLUG.eq(event.getSlug())) + .set(EVENTS.EVENT_DATE_TO, event.getDateTo()) + .where(EVENTS.ID.eq(event.getId())) ); } } diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/event/finder/JooqEventFinder.java b/application/src/main/java/net/furizon/backend/feature/pretix/event/finder/JooqEventFinder.java index 33b46956..5b13d6d5 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/event/finder/JooqEventFinder.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/event/finder/JooqEventFinder.java @@ -28,7 +28,7 @@ public class JooqEventFinder implements EventFinder { EVENTS.EVENT_DATE_FROM, EVENTS.EVENT_IS_CURRENT, EVENTS.EVENT_PUBLIC_URL, - EVENTS.EVENT_NAMES + EVENTS.EVENT_NAMES_JSON ) .from(EVENTS) .where(EVENTS.EVENT_SLUG.eq(slug)) diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/event/mapper/JooqEventMapper.java b/application/src/main/java/net/furizon/backend/feature/pretix/event/mapper/JooqEventMapper.java index 4fff4992..6b0754ff 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/event/mapper/JooqEventMapper.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/event/mapper/JooqEventMapper.java @@ -10,7 +10,6 @@ import org.jooq.Record; import org.springframework.stereotype.Component; -import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Optional; @@ -28,23 +27,15 @@ public class JooqEventMapper { public Event map(Record record) { return Event.builder() .slug(record.get(EVENTS.EVENT_SLUG)) - .dateTo( - Optional.ofNullable(record.get(EVENTS.EVENT_DATE_TO)) - .map(OffsetDateTime::parse) - .orElse(null) - ) - .dateFrom( - Optional.ofNullable(record.get(EVENTS.EVENT_DATE_FROM)) - .map(OffsetDateTime::parse) - .orElse(null) - ) + .dateTo(record.get(EVENTS.EVENT_DATE_TO)) + .dateFrom(record.get(EVENTS.EVENT_DATE_FROM)) .isCurrent(record.get(EVENTS.EVENT_IS_CURRENT)) .publicUrl(record.get(EVENTS.EVENT_PUBLIC_URL)) .eventNames( - Optional.ofNullable(record.get(EVENTS.EVENT_NAMES)) + Optional.ofNullable(record.get(EVENTS.EVENT_NAMES_JSON)) .map(it -> { try { - return objectMapper.readValue(it, typeRef); + return objectMapper.readValue(it.data(), typeRef); } catch (JsonProcessingException e) { log.error("Could not parse event names", e); throw new RuntimeException(e); diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/Order.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/Order.java index f7c8434e..1273c0c1 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/Order.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/Order.java @@ -1,5 +1,6 @@ package net.furizon.backend.feature.pretix.order; +import com.google.common.hash.Hashing; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -19,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.nio.charset.StandardCharsets; import java.time.LocalDate; import java.time.LocalTime; import java.time.ZonedDateTime; @@ -73,15 +75,19 @@ public class Order { private int answersMainPositionId = -1; @Nullable - private User orderOwner; //TODO load from db! (lazy load?) + private User orderOwner; @NotNull - private Event orderEvent; //TODO load from db! (lazy load?) + private Event orderEvent; @NotNull @Setter(AccessLevel.NONE) private Map answers; + public int getId() { + return Hashing.sha512().hashString(code, StandardCharsets.UTF_8).asInt(); + } + public boolean isDaily() { return !dailyDays.isEmpty(); } diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/insertNewOrder/JooqInsertNewOrderAction.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/insertNewOrder/JooqInsertNewOrderAction.java index 8a2708ba..9a634ba0 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/insertNewOrder/JooqInsertNewOrderAction.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/insertNewOrder/JooqInsertNewOrderAction.java @@ -2,6 +2,7 @@ import lombok.RequiredArgsConstructor; import net.furizon.backend.feature.pretix.order.Order; +import net.furizon.backend.feature.user.User; import net.furizon.backend.infrastructure.jackson.JsonSerializer; import net.furizon.backend.infrastructure.pretix.service.PretixInformation; import net.furizon.jooq.infrastructure.command.SqlCommand; @@ -9,6 +10,8 @@ import org.jooq.util.postgres.PostgresDSL; import org.springframework.stereotype.Component; +import java.util.Optional; + import static net.furizon.jooq.generated.Tables.ORDERS; @Component @@ -23,10 +26,14 @@ public void invoke( @NotNull final Order order, @NotNull final PretixInformation pretixInformation ) { + final var userId = Optional.ofNullable(order.getOrderOwner()).map(User::getId).orElse(null); + final var eventId = order.getOrderEvent().getId(); + command.execute( PostgresDSL .insertInto( ORDERS, + ORDERS.ID, ORDERS.ORDER_CODE, ORDERS.ORDER_STATUS, ORDERS.ORDER_SPONSORSHIP_TYPE, @@ -37,11 +44,12 @@ public void invoke( ORDERS.ORDER_SECRET, ORDERS.HAS_MEMBERSHIP, ORDERS.ORDER_ANSWERS_MAIN_POSITION_ID, - //ORDERS.USER_ID, TODO - //ORDERS.EVENT_ID, + ORDERS.USER_ID, + ORDERS.EVENT_ID, ORDERS.ORDER_ANSWERS_JSON ) .values( + order.getId(), order.getCode(), (short) order.getOrderStatus().ordinal(), (short) order.getSponsorship().ordinal(), @@ -52,8 +60,8 @@ public void invoke( order.getPretixOrderSecret(), order.hasMembership(), order.getAnswersMainPositionId(), - //order.getOrderOwner(), - //order.getOrderEvent(), + userId, + eventId, jsonSerializer.serializeAsJson(order.getAllAnswers(pretixInformation)) ) ); diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/updateOrder/JooqUpdateOrderAction.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/updateOrder/JooqUpdateOrderAction.java index 298b8c7c..4bdab58d 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/updateOrder/JooqUpdateOrderAction.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/updateOrder/JooqUpdateOrderAction.java @@ -2,6 +2,7 @@ import lombok.RequiredArgsConstructor; import net.furizon.backend.feature.pretix.order.Order; +import net.furizon.backend.feature.user.User; import net.furizon.backend.infrastructure.jackson.JsonSerializer; import net.furizon.backend.infrastructure.pretix.service.PretixInformation; import net.furizon.jooq.infrastructure.command.SqlCommand; @@ -9,6 +10,8 @@ import org.jooq.util.postgres.PostgresDSL; import org.springframework.stereotype.Component; +import java.util.Optional; + import static net.furizon.jooq.generated.Tables.ORDERS; @Component @@ -23,6 +26,8 @@ public void invoke( @NotNull final Order order, @NotNull final PretixInformation pretixInformation ) { + final var userId = Optional.ofNullable(order.getOrderOwner()).map(User::getId).orElse(null); + command.execute( PostgresDSL .update(ORDERS) @@ -35,10 +40,10 @@ public void invoke( .set(ORDERS.ORDER_SECRET, order.getPretixOrderSecret()) .set(ORDERS.HAS_MEMBERSHIP, order.hasMembership()) .set(ORDERS.ORDER_ANSWERS_MAIN_POSITION_ID, order.getAnswersMainPositionId()) - //.set(ORDERS.USER_ID, order.getOrderOwner()) - //.set(ORDERS.EVENT_ID, order.getOrderEvent()) + .set(ORDERS.USER_ID, userId) + .set(ORDERS.EVENT_ID, order.getOrderEvent().getId()) .set(ORDERS.ORDER_ANSWERS_JSON, serializer.serializeAsJson(order.getAllAnswers(pretixInformation))) - .where(ORDERS.ORDER_CODE.eq(order.getCode())) + .where(ORDERS.ID.eq(order.getId())) ); } } diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/upsertOrder/JooqUpsertOrderAction.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/upsertOrder/JooqUpsertOrderAction.java index 4b2f2cad..28b8743f 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/action/upsertOrder/JooqUpsertOrderAction.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/action/upsertOrder/JooqUpsertOrderAction.java @@ -2,6 +2,7 @@ import lombok.RequiredArgsConstructor; import net.furizon.backend.feature.pretix.order.Order; +import net.furizon.backend.feature.user.User; import net.furizon.backend.infrastructure.jackson.JsonSerializer; import net.furizon.backend.infrastructure.pretix.service.PretixInformation; import net.furizon.jooq.infrastructure.command.SqlCommand; @@ -9,6 +10,8 @@ import org.jooq.util.postgres.PostgresDSL; import org.springframework.stereotype.Component; +import java.util.Optional; + import static net.furizon.jooq.generated.Tables.ORDERS; @Component @@ -33,14 +36,15 @@ public void invoke( String orderSecret = order.getPretixOrderSecret(); boolean membership = order.hasMembership(); int answersMainPositionId = order.getAnswersMainPositionId(); - //User user = order.getOrderOwner(); - //Event event = order.getOrderEvent(); + final var userId = Optional.ofNullable(order.getOrderOwner()).map(User::getId).orElse(null); + final var eventId = order.getOrderEvent().getId(); final var answers = jsonSerializer.serializeAsJson(order.getAllAnswers(pretixInformation)); command.execute( PostgresDSL .insertInto( ORDERS, + ORDERS.ID, ORDERS.ORDER_CODE, ORDERS.ORDER_STATUS, ORDERS.ORDER_SPONSORSHIP_TYPE, @@ -51,11 +55,12 @@ public void invoke( ORDERS.ORDER_SECRET, ORDERS.HAS_MEMBERSHIP, ORDERS.ORDER_ANSWERS_MAIN_POSITION_ID, - //ORDERS.USER_ID, TODO - //ORDERS.EVENT_ID, + ORDERS.USER_ID, + ORDERS.EVENT_ID, ORDERS.ORDER_ANSWERS_JSON ) .values( + order.getId(), code, orderStatus, sponsorship, @@ -66,11 +71,11 @@ public void invoke( orderSecret, membership, answersMainPositionId, - //user, - //event, + userId, + eventId, answers ) - .onConflict(ORDERS.ORDER_CODE) + .onConflict(ORDERS.ID) .doUpdate() .set(ORDERS.ORDER_STATUS, orderStatus) .set(ORDERS.ORDER_SPONSORSHIP_TYPE, sponsorship) diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/finder/JooqOrderFinder.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/finder/JooqOrderFinder.java index 8074c2dc..3fb64a65 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/finder/JooqOrderFinder.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/finder/JooqOrderFinder.java @@ -41,13 +41,13 @@ public class JooqOrderFinder implements OrderFinder { EVENTS.EVENT_DATE_FROM, EVENTS.EVENT_IS_CURRENT, EVENTS.EVENT_PUBLIC_URL, - EVENTS.EVENT_NAMES + EVENTS.EVENT_NAMES_JSON ) .from(ORDERS) .leftOuterJoin(USERS) .on(USERS.USER_ID.eq(ORDERS.USER_ID)) .leftOuterJoin(EVENTS) - .on(EVENTS.EVENT_SLUG.eq(ORDERS.EVENT_ID)) + .on(EVENTS.ID.eq(ORDERS.EVENT_ID)) .where(ORDERS.ORDER_CODE.eq(code)) ).mapOrNull(orderMapper::map); } diff --git a/application/src/main/java/net/furizon/backend/feature/pretix/order/usecase/ReloadOrdersUseCase.java b/application/src/main/java/net/furizon/backend/feature/pretix/order/usecase/ReloadOrdersUseCase.java index 048ddcee..83c94a9c 100644 --- a/application/src/main/java/net/furizon/backend/feature/pretix/order/usecase/ReloadOrdersUseCase.java +++ b/application/src/main/java/net/furizon/backend/feature/pretix/order/usecase/ReloadOrdersUseCase.java @@ -27,8 +27,9 @@ public class ReloadOrdersUseCase implements UseCase Do we need InsertNewOrderAction if we have UpsertOrderAction? @NotNull - private final UpsertOrderAction insertOrUpdateOrderAction; + private final UpsertOrderAction upsertOrderAction; @NotNull private final DeleteOrderAction deleteOrderAction; @@ -49,7 +50,7 @@ public Boolean executor(@NotNull Input input) { Order order = orderOpt.get(); OrderStatus os = order.getOrderStatus(); if (os == OrderStatus.PENDING || os == OrderStatus.PAID) { - insertOrUpdateOrderAction.invoke(order, input.pretixInformation); + upsertOrderAction.invoke(order, input.pretixInformation); shouldDelete = false; } } diff --git a/db/migrations/000001_model.down.sql b/db/migrations/000001_model.down.sql index ffa7f5c3..124fd272 100644 --- a/db/migrations/000001_model.down.sql +++ b/db/migrations/000001_model.down.sql @@ -1,3 +1,5 @@ +DROP INDEX IF EXISTS event_slug_idx; + DROP TABLE IF EXISTS events; DROP TABLE IF EXISTS "groups"; DROP TABLE IF EXISTS users; diff --git a/db/migrations/000001_model.up.sql b/db/migrations/000001_model.up.sql index 0aea8fe1..96fc05a4 100644 --- a/db/migrations/000001_model.up.sql +++ b/db/migrations/000001_model.up.sql @@ -1,12 +1,12 @@ CREATE TABLE IF NOT EXISTS events ( - event_slug varchar(255) NOT NULL, - event_date_to varchar(32) NULL, -- Probable better to use timestamp type -- - event_date_from varchar(32) NULL, -- Probable better to use timestamp type -- - event_is_current bool NOT NULL, - event_public_url text NOT NULL, - event_names text NULL, - CONSTRAINT events_pkey PRIMARY KEY (event_slug) + id int PRIMARY KEY NOT NULL, + event_slug varchar(255) NOT NULL, + event_date_to timestamptz NULL, + event_date_from timestamptz NULL, + event_is_current bool NOT NULL, + event_public_url text NOT NULL, + event_names_json json NULL ); CREATE TABLE IF NOT EXISTS "groups" @@ -112,24 +112,24 @@ CREATE TABLE IF NOT EXISTS membership_cards CREATE TABLE IF NOT EXISTS orders ( - order_code varchar(64) NOT NULL, - order_answers_json json NULL, - order_status int2 DEFAULT 0 NOT NULL, - order_answers_main_position_id int4 NOT NULL, - order_daily_days int8 NOT NULL, - order_extra_days_type int2 NULL, - order_room_capacity int2 NULL, + id int PRIMARY KEY NOT NULL, + order_code varchar(64) NOT NULL, + order_answers_json json NULL, + order_status int2 DEFAULT 0 NOT NULL, + order_answers_main_position_id int4 NOT NULL, + order_daily_days int8 NOT NULL, + order_extra_days_type int2 NULL, + order_room_capacity int2 NULL, order_hotel_location varchar(255), - has_membership bool NOT NULL, - order_secret varchar(32) NULL, - order_sponsorship_type int2 NULL, - event_id varchar(255) NULL, - user_id int8 NULL, + has_membership bool NOT NULL, + order_secret varchar(32) NULL, + order_sponsorship_type int2 NULL, + event_id int NOT NULL, + user_id int8 NULL, CONSTRAINT orders_extra_days_check CHECK (((order_extra_days_type >= 0) AND (order_extra_days_type <= 3))), - CONSTRAINT orders_pkey PRIMARY KEY (order_code), CONSTRAINT orders_sponsorship_check CHECK (((order_sponsorship_type >= 0) AND (order_sponsorship_type <= 2))), CONSTRAINT orders_status_check CHECK (((order_status >= 0) AND (order_status <= 3))), - CONSTRAINT orders_events_id FOREIGN KEY (event_id) REFERENCES events (event_slug), + CONSTRAINT orders_events_id FOREIGN KEY (event_id) REFERENCES events (id), CONSTRAINT orders_users_id FOREIGN KEY (user_id) REFERENCES users (user_id) ); @@ -138,9 +138,9 @@ CREATE TABLE IF NOT EXISTS rooms room_id int8 GENERATED BY DEFAULT AS IDENTITY ( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, room_confirmed bool NULL, room_name varchar(255) NULL, - order_id varchar(64) NULL, + order_id int NULL, CONSTRAINT rooms_pkey PRIMARY KEY (room_id), - CONSTRAINT rooms_orders_id FOREIGN KEY (order_id) REFERENCES orders (order_code) + CONSTRAINT rooms_orders_id FOREIGN KEY (order_id) REFERENCES orders (id) ); CREATE TABLE IF NOT EXISTS user_group diff --git a/jooq-common/src/main/java/net/furizon/jooq/generated/Keys.java b/jooq-common/src/main/java/net/furizon/jooq/generated/Keys.java index 62e86685..ec2d68d8 100644 --- a/jooq-common/src/main/java/net/furizon/jooq/generated/Keys.java +++ b/jooq-common/src/main/java/net/furizon/jooq/generated/Keys.java @@ -51,7 +51,7 @@ public class Keys { public static final UniqueKey AUTHENTICATIONS_PKEY = Internal.createUniqueKey(Authentications.AUTHENTICATIONS, DSL.name("authentications_pkey"), new TableField[] { Authentications.AUTHENTICATIONS.AUTHENTICATION_ID }, true); public static final UniqueKey AUTHENTICATIONS_UNIQUE_EMAIL = Internal.createUniqueKey(Authentications.AUTHENTICATIONS, DSL.name("authentications_unique_email"), new TableField[] { Authentications.AUTHENTICATIONS.AUTHENTICATION_EMAIL }, true); public static final UniqueKey AUTHENTICATIONS_UNIQUE_USER_ID = Internal.createUniqueKey(Authentications.AUTHENTICATIONS, DSL.name("authentications_unique_user_id"), new TableField[] { Authentications.AUTHENTICATIONS.USER_ID }, true); - public static final UniqueKey EVENTS_PKEY = Internal.createUniqueKey(Events.EVENTS, DSL.name("events_pkey"), new TableField[] { Events.EVENTS.EVENT_SLUG }, true); + public static final UniqueKey EVENTS_PKEY = Internal.createUniqueKey(Events.EVENTS, DSL.name("events_pkey"), new TableField[] { Events.EVENTS.ID }, true); public static final UniqueKey FURSUITS_PKEY = Internal.createUniqueKey(Fursuits.FURSUITS, DSL.name("fursuits_pkey"), new TableField[] { Fursuits.FURSUITS.FURSUIT_ID }, true); public static final UniqueKey FURSUITS_EVENTS_PK = Internal.createUniqueKey(FursuitsEvents.FURSUITS_EVENTS, DSL.name("fursuits_events_pk"), new TableField[] { FursuitsEvents.FURSUITS_EVENTS.EVENT_ID, FursuitsEvents.FURSUITS_EVENTS.FURSUIT_ID }, true); public static final UniqueKey GROUP_PERMISSIONS_PK = Internal.createUniqueKey(GroupPermissions.GROUP_PERMISSIONS, DSL.name("group_permissions_pk"), new TableField[] { GroupPermissions.GROUP_PERMISSIONS.PERMISSION_CODE, GroupPermissions.GROUP_PERMISSIONS.GROUP_ID }, true); @@ -59,7 +59,7 @@ public class Keys { public static final UniqueKey MEDIA_PKEY = Internal.createUniqueKey(Media.MEDIA, DSL.name("media_pkey"), new TableField[] { Media.MEDIA.MEDIA_ID }, true); public static final UniqueKey CARDS_PKEY = Internal.createUniqueKey(MembershipCards.MEMBERSHIP_CARDS, DSL.name("cards_pkey"), new TableField[] { MembershipCards.MEMBERSHIP_CARDS.CARD_DB_ID }, true); public static final UniqueKey MEMBERSHIP_INFO_ID_PKEY = Internal.createUniqueKey(MembershipInfo.MEMBERSHIP_INFO, DSL.name("membership_info_id_pkey"), new TableField[] { MembershipInfo.MEMBERSHIP_INFO.USER_ID }, true); - public static final UniqueKey ORDERS_PKEY = Internal.createUniqueKey(Orders.ORDERS, DSL.name("orders_pkey"), new TableField[] { Orders.ORDERS.ORDER_CODE }, true); + public static final UniqueKey ORDERS_PKEY = Internal.createUniqueKey(Orders.ORDERS, DSL.name("orders_pkey"), new TableField[] { Orders.ORDERS.ID }, true); public static final UniqueKey ROOM_GUESTS_PKEY = Internal.createUniqueKey(RoomGuests.ROOM_GUESTS, DSL.name("room_guests_pkey"), new TableField[] { RoomGuests.ROOM_GUESTS.ROOM_GUEST_ID }, true); public static final UniqueKey ROOMS_PKEY = Internal.createUniqueKey(Rooms.ROOMS, DSL.name("rooms_pkey"), new TableField[] { Rooms.ROOMS.ROOM_ID }, true); public static final UniqueKey SCHEMA_MIGRATIONS_PKEY = Internal.createUniqueKey(SchemaMigrations.SCHEMA_MIGRATIONS, DSL.name("schema_migrations_pkey"), new TableField[] { SchemaMigrations.SCHEMA_MIGRATIONS.VERSION }, true); @@ -77,11 +77,11 @@ public class Keys { public static final ForeignKey FURSUITS_EVENTS__FURSUITS_EVENTS_FURSUIT_FK = Internal.createForeignKey(FursuitsEvents.FURSUITS_EVENTS, DSL.name("fursuits_events_fursuit_fk"), new TableField[] { FursuitsEvents.FURSUITS_EVENTS.FURSUIT_ID }, Keys.FURSUITS_PKEY, new TableField[] { Fursuits.FURSUITS.FURSUIT_ID }, true); public static final ForeignKey MEMBERSHIP_CARDS__CARD_USER_FK = Internal.createForeignKey(MembershipCards.MEMBERSHIP_CARDS, DSL.name("card_user_fk"), new TableField[] { MembershipCards.MEMBERSHIP_CARDS.USER_ID }, Keys.USERS_PKEY, new TableField[] { Users.USERS.USER_ID }, true); public static final ForeignKey MEMBERSHIP_INFO__MEMBERSHIP_INFO_USERS_FK = Internal.createForeignKey(MembershipInfo.MEMBERSHIP_INFO, DSL.name("membership_info_users_fk"), new TableField[] { MembershipInfo.MEMBERSHIP_INFO.USER_ID }, Keys.USERS_PKEY, new TableField[] { Users.USERS.USER_ID }, true); - public static final ForeignKey ORDERS__ORDERS_EVENTS_ID = Internal.createForeignKey(Orders.ORDERS, DSL.name("orders_events_id"), new TableField[] { Orders.ORDERS.EVENT_ID }, Keys.EVENTS_PKEY, new TableField[] { Events.EVENTS.EVENT_SLUG }, true); + public static final ForeignKey ORDERS__ORDERS_EVENTS_ID = Internal.createForeignKey(Orders.ORDERS, DSL.name("orders_events_id"), new TableField[] { Orders.ORDERS.EVENT_ID }, Keys.EVENTS_PKEY, new TableField[] { Events.EVENTS.ID }, true); public static final ForeignKey ORDERS__ORDERS_USERS_ID = Internal.createForeignKey(Orders.ORDERS, DSL.name("orders_users_id"), new TableField[] { Orders.ORDERS.USER_ID }, Keys.USERS_PKEY, new TableField[] { Users.USERS.USER_ID }, true); public static final ForeignKey ROOM_GUESTS__ROOM_GUESTS_ROOMS_FK = Internal.createForeignKey(RoomGuests.ROOM_GUESTS, DSL.name("room_guests_rooms_fk"), new TableField[] { RoomGuests.ROOM_GUESTS.ROOM_ID }, Keys.ROOMS_PKEY, new TableField[] { Rooms.ROOMS.ROOM_ID }, true); public static final ForeignKey ROOM_GUESTS__ROOM_GUESTS_USERS_FK = Internal.createForeignKey(RoomGuests.ROOM_GUESTS, DSL.name("room_guests_users_fk"), new TableField[] { RoomGuests.ROOM_GUESTS.USER_ID }, Keys.USERS_PKEY, new TableField[] { Users.USERS.USER_ID }, true); - public static final ForeignKey ROOMS__ROOMS_ORDERS_ID = Internal.createForeignKey(Rooms.ROOMS, DSL.name("rooms_orders_id"), new TableField[] { Rooms.ROOMS.ORDER_ID }, Keys.ORDERS_PKEY, new TableField[] { Orders.ORDERS.ORDER_CODE }, true); + public static final ForeignKey ROOMS__ROOMS_ORDERS_ID = Internal.createForeignKey(Rooms.ROOMS, DSL.name("rooms_orders_id"), new TableField[] { Rooms.ROOMS.ORDER_ID }, Keys.ORDERS_PKEY, new TableField[] { Orders.ORDERS.ID }, true); public static final ForeignKey USER_GROUP__USER_GROUP_GROUPS_FK = Internal.createForeignKey(UserGroup.USER_GROUP, DSL.name("user_group_groups_fk"), new TableField[] { UserGroup.USER_GROUP.GROUP_ID }, Keys.GROUPS_PKEY, new TableField[] { Groups.GROUPS.GROUP_ID }, true); public static final ForeignKey USER_GROUP__USER_GROUP_USERS_FK = Internal.createForeignKey(UserGroup.USER_GROUP, DSL.name("user_group_users_fk"), new TableField[] { UserGroup.USER_GROUP.USER_ID }, Keys.USERS_PKEY, new TableField[] { Users.USERS.USER_ID }, true); public static final ForeignKey USERS__USER_MEDIA_FK = Internal.createForeignKey(Users.USERS, DSL.name("user_media_fk"), new TableField[] { Users.USERS.MEDIA_ID_PROPIC }, Keys.MEDIA_PKEY, new TableField[] { Media.MEDIA.MEDIA_ID }, true); diff --git a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Events.java b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Events.java index 87e76066..31e0c338 100644 --- a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Events.java +++ b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Events.java @@ -4,6 +4,7 @@ package net.furizon.jooq.generated.tables; +import java.time.OffsetDateTime; import java.util.Collection; import javax.annotation.processing.Generated; @@ -17,6 +18,7 @@ import org.jooq.Field; import org.jooq.ForeignKey; import org.jooq.InverseForeignKey; +import org.jooq.JSON; import org.jooq.Name; import org.jooq.Path; import org.jooq.PlainSQL; @@ -63,6 +65,11 @@ public Class getRecordType() { return Record.class; } + /** + * The column public.events.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false), this, ""); + /** * The column public.events.event_slug. */ @@ -71,12 +78,12 @@ public Class getRecordType() { /** * The column public.events.event_date_to. */ - public final TableField EVENT_DATE_TO = createField(DSL.name("event_date_to"), SQLDataType.VARCHAR(32), this, ""); + public final TableField EVENT_DATE_TO = createField(DSL.name("event_date_to"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); /** * The column public.events.event_date_from. */ - public final TableField EVENT_DATE_FROM = createField(DSL.name("event_date_from"), SQLDataType.VARCHAR(32), this, ""); + public final TableField EVENT_DATE_FROM = createField(DSL.name("event_date_from"), SQLDataType.TIMESTAMPWITHTIMEZONE(6), this, ""); /** * The column public.events.event_is_current. @@ -89,9 +96,9 @@ public Class getRecordType() { public final TableField EVENT_PUBLIC_URL = createField(DSL.name("event_public_url"), SQLDataType.CLOB.nullable(false), this, ""); /** - * The column public.events.event_names. + * The column public.events.event_names_json. */ - public final TableField EVENT_NAMES = createField(DSL.name("event_names"), SQLDataType.CLOB, this, ""); + public final TableField EVENT_NAMES_JSON = createField(DSL.name("event_names_json"), SQLDataType.JSON, this, ""); private Events(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); diff --git a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Orders.java b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Orders.java index 406b364c..a17e2999 100644 --- a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Orders.java +++ b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Orders.java @@ -70,6 +70,11 @@ public Class getRecordType() { return Record.class; } + /** + * The column public.orders.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false), this, ""); + /** * The column public.orders.order_code. */ @@ -128,7 +133,7 @@ public Class getRecordType() { /** * The column public.orders.event_id. */ - public final TableField EVENT_ID = createField(DSL.name("event_id"), SQLDataType.VARCHAR(255), this, ""); + public final TableField EVENT_ID = createField(DSL.name("event_id"), SQLDataType.INTEGER.nullable(false), this, ""); /** * The column public.orders.user_id. diff --git a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Rooms.java b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Rooms.java index e7efa005..e0a484c4 100644 --- a/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Rooms.java +++ b/jooq-common/src/main/java/net/furizon/jooq/generated/tables/Rooms.java @@ -85,7 +85,7 @@ public Class getRecordType() { /** * The column public.rooms.order_id. */ - public final TableField ORDER_ID = createField(DSL.name("order_id"), SQLDataType.VARCHAR(64), this, ""); + public final TableField ORDER_ID = createField(DSL.name("order_id"), SQLDataType.INTEGER, this, ""); private Rooms(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); diff --git a/pom.xml b/pom.xml index 5b3c1129..a9f8faaf 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,7 @@ 42.7.4 3.19.13 3.17.0 + 33.3.1-jre @@ -47,6 +48,12 @@ commons-lang3 ${commons.lang.version} + + com.google.guava + guava + ${guava.version} + +