diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/config/BookingDiModule.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/config/BookingDiModule.kt index b4a0c851837b47c738a98addf6753c81ea1d420d..8939500189a0abcc45da1dd25d9183ff44c75504 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/config/BookingDiModule.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/config/BookingDiModule.kt @@ -1,5 +1,6 @@ package office.effective.features.booking.config +import office.effective.features.booking.converters.BookingFacadeConverter import office.effective.features.booking.converters.BookingRepositoryConverter import office.effective.features.booking.facade.BookingFacade import office.effective.features.booking.repository.BookingRepository @@ -10,5 +11,6 @@ val bookingDiModule = module(createdAtStart = true) { single { BookingRepositoryConverter(get(), get(), get()) } single { BookingRepository(get(), get()) } single { BookingService(get(), get(), get()) } + single { BookingFacadeConverter(get(), get(), get()) } single { BookingFacade(get(), get(), get(), get()) } } diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.0.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.0.yaml index a9f13bb8887fd7ab6543db9c05c2cf1815a696e4..8f639ca9c2bf527a20832d65242af271608399e1 100644 --- a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.0.yaml +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.0.yaml @@ -21,6 +21,7 @@ databaseChangeLog: name: icon_url type: varchar(255) constraints: + unique: true nullable: false - changeSet: @@ -73,43 +74,3 @@ databaseChangeLog: referencedTableName: workspace_tags referencedColumnNames: id constraintName: fk_workspaces_tag_id - - - changeSet: - id: create-workspace-utilities-table - author: zavyalov-daniil - changes: - - createTable: - tableName: workspace_utilities - columns: - - column: - name: utility_id - type: uuid - constraints: - nullable: false - - column: - name: workspace_id - type: uuid - constraints: - nullable: false - - column: - name: count - type: int - remarks: "> 0" - constraints: - nullable: false - - addPrimaryKey: - tableName: workspace_utilities - columnNames: utility_id, workspace_id - constraintName: pk_workspace_utilities - - addForeignKeyConstraint: - baseTableName: workspace_utilities - baseColumnNames: utility_id - referencedTableName: utilities - referencedColumnNames: id - constraintName: fk_workspace_utility_id - - addForeignKeyConstraint: - baseTableName: workspace_utilities - baseColumnNames: workspace_id - referencedTableName: workspaces - referencedColumnNames: id - constraintName: fk_utility_workspace_id diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.1.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.1.yaml index 927bd02baf13de282765043c584bb4da42372507..7d2142a1cd242c478da6361b454500d1db24fd30 100644 --- a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.1.yaml +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.1.yaml @@ -1,127 +1,46 @@ databaseChangeLog: - changeSet: - id: create-users-tags-table + id: create-uint-domain author: zavyalov-daniil changes: - - createTable: - tableName: users_tags - columns: - - column: - name: id - type: uuid - constraints: - primaryKey: true - primaryKeyName: pk_users_tags - - column: - name: name - type: varchar(255) - remarks: "Student, Worker, etc." - constraints: - nullable: false - - - changeSet: - id: create-users-table - author: zavyalov-daniil - changes: - - createTable: - tableName: users - columns: - - column: - name: id - type: uuid - constraints: - primaryKey: true - primaryKeyName: pk_users - - column: - name: full_name - type: varchar(255) - constraints: - nullable: false - - column: - name: tag_id - type: uuid - constraints: - nullable: false - - column: - name: active - type: boolean - defaultValueBoolean: true - constraints: - nullable: false - - column: - name: role - type: varchar(255) - remarks: "I. e. Android-developer" - - column: - name: avatar_url - type: varchar(255) - - addForeignKeyConstraint: - baseTableName: users - baseColumnNames: tag_id - referencedTableName: users_tags - referencedColumnNames: id - constraintName: fk_users_tag_id - - - changeSet: - id: create-integrations-table - author: zavyalov-daniil - changes: - - createTable: - tableName: integrations - columns: - - column: - name: id - type: uuid - constraints: - primaryKey: true - primaryKeyName: pk_integrations - - column: - name: name - type: varchar(255) - constraints: - nullable: false - - column: - name: icon_url - type: varchar(255) - constraints: - nullable: false + - sql: CREATE DOMAIN uint_domain AS int CHECK(VALUE >= 0); - changeSet: - id: create-users-integrations-table + id: create-workspace-utilities-table author: zavyalov-daniil changes: - createTable: - tableName: users_integrations + tableName: workspace_utilities columns: - column: - name: user_id + name: utility_id type: uuid constraints: nullable: false - column: - name: integration_id + name: workspace_id type: uuid constraints: nullable: false - column: - name: value - type: varchar(255) - remarks: "For telegram is, for example, user tag @user" + name: count + type: uint_domain + remarks: "> 0" constraints: nullable: false - addPrimaryKey: - tableName: users_integrations - columnNames: integration_id, user_id - constraintName: pk_users_integrations + tableName: workspace_utilities + columnNames: utility_id, workspace_id + constraintName: pk_workspace_utilities - addForeignKeyConstraint: - baseTableName: users_integrations - baseColumnNames: integration_id - referencedTableName: integrations + baseTableName: workspace_utilities + baseColumnNames: utility_id + referencedTableName: utilities referencedColumnNames: id - constraintName: fk_user_integration_id + constraintName: fk_workspace_utility_id - addForeignKeyConstraint: - baseTableName: users_integrations - baseColumnNames: user_id - referencedTableName: users + baseTableName: workspace_utilities + baseColumnNames: workspace_id + referencedTableName: workspaces referencedColumnNames: id - constraintName: fk_integration_user_id + constraintName: fk_utility_workspace_id \ No newline at end of file diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.2.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.2.yaml index 9b565df95b215bfdfd4edee500253f2807469b5b..fcdc08c801ce8e4ed7c0b6af903332022997adf7 100644 --- a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.2.yaml +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.2.yaml @@ -1,57 +1,99 @@ databaseChangeLog: - changeSet: - id: create-workspace-booking-table + id: create-users-tags-table author: zavyalov-daniil changes: - createTable: - tableName: workspace_booking + tableName: users_tags columns: - column: - name: owner_id + name: id type: uuid constraints: - nullable: false + primaryKey: true + primaryKeyName: pk_users_tags - column: - name: workspace_id - type: uuid + name: name + type: varchar(255) + remarks: "Student, Worker, etc." constraints: nullable: false + + - changeSet: + id: create-users-table + author: zavyalov-daniil + changes: + - createTable: + tableName: users + columns: - column: name: id type: uuid - remarks: "Using to refer existing booking without additional business logic" constraints: primaryKey: true - primaryKeyName: pk_workspace_booking + primaryKeyName: pk_users + - column: + name: full_name + type: varchar(255) + constraints: + nullable: false - column: - name: begin_booking - type: timestamp + name: tag_id + type: uuid constraints: nullable: false - column: - name: end_booking - type: timestamp + name: active + type: boolean + defaultValueBoolean: true constraints: nullable: false + - column: + name: role + type: varchar(255) + remarks: "I. e. Android-developer" + - column: + name: avatar_url + type: varchar(255) - addForeignKeyConstraint: - baseTableName: workspace_booking - baseColumnNames: owner_id - referencedTableName: users - referencedColumnNames: id - constraintName: fk_workspace_booking_owner - - addForeignKeyConstraint: - baseTableName: workspace_booking - baseColumnNames: workspace_id - referencedTableName: workspaces + baseTableName: users + baseColumnNames: tag_id + referencedTableName: users_tags referencedColumnNames: id - constraintName: fk_booking_workspace_id + constraintName: fk_users_tag_id - changeSet: - id: create-booking_participants-table + id: create-integrations-table author: zavyalov-daniil changes: - createTable: - tableName: booking_participants + tableName: integrations + columns: + - column: + name: id + type: uuid + constraints: + primaryKey: true + primaryKeyName: pk_integrations + - column: + name: name + type: varchar(255) + constraints: + unique: true + nullable: false + checkConstraint: + - column: + name: icon_url + type: varchar(255) + constraints: + nullable: false + + - changeSet: + id: create-users-integrations-table + author: zavyalov-daniil + changes: + - createTable: + tableName: users_integrations columns: - column: name: user_id @@ -59,23 +101,29 @@ databaseChangeLog: constraints: nullable: false - column: - name: booking_id + name: integration_id type: uuid constraints: nullable: false + - column: + name: value + type: varchar(255) + remarks: "For telegram is, for example, user tag @user" + constraints: + nullable: false - addPrimaryKey: - tableName: booking_participants - columnNames: user_id, booking_id - constraintName: pk_booking_participants + tableName: users_integrations + columnNames: integration_id, user_id + constraintName: pk_users_integrations - addForeignKeyConstraint: - baseTableName: booking_participants - baseColumnNames: user_id - referencedTableName: users + baseTableName: users_integrations + baseColumnNames: integration_id + referencedTableName: integrations referencedColumnNames: id - constraintName: fk_booking_participant_id + constraintName: fk_user_integration_id - addForeignKeyConstraint: - baseTableName: booking_participants - baseColumnNames: booking_id - referencedTableName: workspace_booking + baseTableName: users_integrations + baseColumnNames: user_id + referencedTableName: users referencedColumnNames: id - constraintName: fk_participants_workspace_booking_id + constraintName: fk_integration_user_id diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.3.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.3.yaml index 6d576b927c60643dcdc8ea1d0ed795117a49ce87..62859362be791ba4f3aaeacb74537c259bec4673 100644 --- a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.3.yaml +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.3.yaml @@ -1,27 +1,82 @@ databaseChangeLog: - changeSet: - id: insert-workspace-meeting-tag + id: create-workspace-booking-table author: zavyalov-daniil changes: - - insert: - tableName: workspace_tags + - createTable: + tableName: workspace_booking columns: + - column: + name: owner_id + type: uuid + constraints: + nullable: false + - column: + name: workspace_id + type: uuid + constraints: + nullable: false - column: name: id - value: 88c12f1a-e91e-4088-9378-c03333f39cc8 + type: uuid + remarks: "Using to refer existing booking without additional business logic" + constraints: + primaryKey: true + primaryKeyName: pk_workspace_booking - column: - name: name - value: meeting + name: begin_booking + type: timestamp + constraints: + nullable: false + - column: + name: end_booking + type: timestamp + constraints: + nullable: false + - addForeignKeyConstraint: + baseTableName: workspace_booking + baseColumnNames: owner_id + referencedTableName: users + referencedColumnNames: id + constraintName: fk_workspace_booking_owner + - addForeignKeyConstraint: + baseTableName: workspace_booking + baseColumnNames: workspace_id + referencedTableName: workspaces + referencedColumnNames: id + constraintName: fk_booking_workspace_id + - sql: ALTER TABLE workspace_booking ADD CONSTRAINT check_booking_end_gt_begin CHECK (end_booking > begin_booking); + - changeSet: - id: insert-workspace-regular-tag + id: create-booking_participants-table author: zavyalov-daniil changes: - - insert: - tableName: workspace_tags + - createTable: + tableName: booking_participants columns: - column: - name: id - value: 451fff7d-c388-45d1-8454-4eaefaec81cc + name: user_id + type: uuid + constraints: + nullable: false - column: - name: name - value: regular + name: booking_id + type: uuid + constraints: + nullable: false + - addPrimaryKey: + tableName: booking_participants + columnNames: user_id, booking_id + constraintName: pk_booking_participants + - addForeignKeyConstraint: + baseTableName: booking_participants + baseColumnNames: user_id + referencedTableName: users + referencedColumnNames: id + constraintName: fk_booking_participant_id + - addForeignKeyConstraint: + baseTableName: booking_participants + baseColumnNames: booking_id + referencedTableName: workspace_booking + referencedColumnNames: id + constraintName: fk_participants_workspace_booking_id diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.4.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.4.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6d576b927c60643dcdc8ea1d0ed795117a49ce87 --- /dev/null +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.4.yaml @@ -0,0 +1,27 @@ +databaseChangeLog: + - changeSet: + id: insert-workspace-meeting-tag + author: zavyalov-daniil + changes: + - insert: + tableName: workspace_tags + columns: + - column: + name: id + value: 88c12f1a-e91e-4088-9378-c03333f39cc8 + - column: + name: name + value: meeting + - changeSet: + id: insert-workspace-regular-tag + author: zavyalov-daniil + changes: + - insert: + tableName: workspace_tags + columns: + - column: + name: id + value: 451fff7d-c388-45d1-8454-4eaefaec81cc + - column: + name: name + value: regular diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.5.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.5.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d9ff3e504246d61a8ca4a4af406f44fc9ddedf0d --- /dev/null +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-1.5.yaml @@ -0,0 +1,15 @@ +databaseChangeLog: + - changeSet: + id: unique-integration-name-constraint + author: zavyalov-daniil + changes: + - addUniqueConstraint: + columnNames: name + tableName: integrations + - changeSet: + id: unique-utility-name-constraint + author: zavyalov-daniil + changes: + - addUniqueConstraint: + columnNames: name + tableName: utilities diff --git a/effectiveOfficeBackend/src/main/resources/changelog/changelog-master.yaml b/effectiveOfficeBackend/src/main/resources/changelog/changelog-master.yaml index 70a59fe0c17cd520da7cc968f794e1e80abc9a83..b4dcaa56ed625d95676171763857ab027de184fd 100644 --- a/effectiveOfficeBackend/src/main/resources/changelog/changelog-master.yaml +++ b/effectiveOfficeBackend/src/main/resources/changelog/changelog-master.yaml @@ -2,8 +2,12 @@ databaseChangeLog: - include: file: changelog/changelog-1.0.yaml - include: - file: changelog/changelog-1.1.yaml + file: changelog/changelog-1.1.yaml #create uint_domain and workspace-utilities table - include: file: changelog/changelog-1.2.yaml - include: - file: changelog/changelog-1.3.yaml \ No newline at end of file + file: changelog/changelog-1.3.yaml + - include: + file: changelog/changelog-1.4.yaml + - include: + file: changelog/changelog-1.5.yaml \ No newline at end of file