diff --git a/.env.development b/.env.development index df126e6..5bc876e 100644 --- a/.env.development +++ b/.env.development @@ -1,8 +1,9 @@ NEXT_PUBLIC_APP_URL=localhost:3000 -NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFUOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QS4u" -NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFURUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMS4u" +NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs0LFaOQJoXlHrbsK8Pa1si9UOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QSQlQCN0PWcu" +NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs0LFaOQJoXlHrbsK8Pa1si9URUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMSQlQCN0PWcu" NEXT_PUBLIC_BLOBSERVICECLIENT_URL="https://thesisplatformdev.blob.core.windows.net/uploads?" APPLICATION_URL="https://prod-16.switzerlandnorth.logic.azure.com:443/workflows/59277f26083740e5bff291f9b93ae017/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=YoKvNPy9vcURljhJzSxEEaWVIO1J_PJYJJ0j38xfGOw" PROPOSAL_FEEDBACK_URL="https://prod-14.switzerlandnorth.logic.azure.com:443/workflows/df4d7fd584834de1bcac66150f2d7e15/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=zVrizkBYfyIikgpVkQmNAM2IOJ8eHfJpvIvr7tdC3hc" NEXT_PUBLIC_CONTAINER_NAME=uploads NEXT_PUBLIC_AZURE_STORAGE_ACCOUNT_NAME=thesisplatformdev +FLOW_SECRET=abcd diff --git a/.env.local.template b/.env.local.template index 52d4cc5..2259d20 100644 --- a/.env.local.template +++ b/.env.local.template @@ -5,4 +5,6 @@ NEXT_PUBLIC_BLOBSERVICECLIENT_URL= APPLICATION_URL= PROPOSAL_FEEDBACK_URL= NEXT_PUBLIC_CONTAINER_NAME= -NEXT_PUBLIC_AZURE_STORAGE_ACCOUNT_NAME= \ No newline at end of file +NEXT_PUBLIC_AZURE_STORAGE_ACCOUNT_NAME= +FLOW_SECRET= +APPLICATION_ACCEPTANCE_URL= \ No newline at end of file diff --git a/.env.production b/.env.production index c61d155..91c8699 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,6 @@ NEXT_PUBLIC_APP_URL=theses.bf.uzh.ch -NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs_TeTD3rkXtGpbExdNgeYCZUMkpSRUdOUUYxMlU4SEI3MDk4OUw5T0QzTS4u" -NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs_TeTD3rkXtGpbExdNgeYCZUNkpHOVo4MlREUTJPNE9LV0lVUEVSOElJVC4u" +NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs9iU1p12TNBNlqpakIPkkQVUMkpSRUdOUUYxMlU4SEI3MDk4OUw5T0QzTSQlQCN0PWcu" +NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs9iU1p12TNBNlqpakIPkkQVUNkpHOVo4MlREUTJPNE9LV0lVUEVSOElJVCQlQCN0PWcu" NEXT_PUBLIC_BLOBSERVICECLIENT_URL="https://thesisplatformdev.blob.core.windows.net/uploads?" NEXT_PUBLIC_CONTAINER_NAME=uploads NEXT_PUBLIC_AZURE_STORAGE_ACCOUNT_NAME=thesisplatformdev diff --git a/.env.stage b/.env.stage index 9550ee3..ccfdae4 100644 --- a/.env.stage +++ b/.env.stage @@ -1,8 +1,6 @@ NEXT_PUBLIC_APP_URL=theses.stage.env.bf-app.ch -NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFUOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QS4u&embed=true" -NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFURUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMS4u&embed=true" +NEXT_PUBLIC_FORMS_URL_PUBLISH="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFUOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QS4u" +NEXT_PUBLIC_FORMS_URL_SUBMIT="https://forms.office.com/Pages/ResponsePage.aspx?id=2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFURUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMS4u" NEXT_PUBLIC_BLOBSERVICECLIENT_URL="https://thesisplatformdev.blob.core.windows.net/uploads?" -NEXT_PUBLIC_APPLICATION_URL="https://prod-16.switzerlandnorth.logic.azure.com:443/workflows/59277f26083740e5bff291f9b93ae017/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=YoKvNPy9vcURljhJzSxEEaWVIO1J_PJYJJ0j38xfGOw" -NEXT_PUBLIC_PROPOSAL_FEEDBACK_URL="https://prod-14.switzerlandnorth.logic.azure.com:443/workflows/df4d7fd584834de1bcac66150f2d7e15/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=zVrizkBYfyIikgpVkQmNAM2IOJ8eHfJpvIvr7tdC3hc" NEXT_PUBLIC_CONTAINER_NAME=uploads NEXT_PUBLIC_AZURE_STORAGE_ACCOUNT_NAME=thesisplatformdev diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d8d4ce0..3be841d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -43,11 +43,12 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # - name: Replace .env.production with .env.stage - # shell: bash - # run: | - # rm .env.production - # mv .env.stage .env.production + - name: Replace .env.production with .env.stage + shell: bash + run: | + rm .env.production + mv .env.stage .env.production + if: github.ref == 'refs/heads/dev' - name: Build and push Docker image uses: docker/build-push-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..339c768 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,188 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [1.0.0-beta.12](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2024-02-27) + +## [1.0.0-beta.11](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2024-02-15) + +## [1.0.0-beta.10](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2024-01-24) + + +### Features + +* **prisma:** extended db by admin info table ([#23](https://github.com/uzh-bf/thesis-platform/issues/23)) ([867dc63](https://github.com/uzh-bf/thesis-platform/commit/867dc631fa31da71f854608eaea9f9798c4bc3c1)) + +## [1.0.0-beta.9](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2023-12-18) + + +### Features + +* **app:** Developer role added that can see applications on all supervisor proposals ([#21](https://github.com/uzh-bf/thesis-platform/issues/21)) ([d61fabd](https://github.com/uzh-bf/thesis-platform/commit/d61fabd2479b063882ad05ed3d8ffc1a0b9ebe21)) + + +### Bug Fixes + +* **app:** check against all emails on multiple feedbacks ([2219cfe](https://github.com/uzh-bf/thesis-platform/commit/2219cfe8949a27121dfdd28812810f4617507d45)) + +## [1.0.0-beta.8](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2023-12-14) + + +### Enhancements + +* **prisma:** Timestamps added for UserProposalSupervision and UserProposalFeedback ([#20](https://github.com/uzh-bf/thesis-platform/issues/20)) ([ee99961](https://github.com/uzh-bf/thesis-platform/commit/ee99961454ee7634ce10a6a9a1b94f4b1f09bab2)) + +## [1.0.0-beta.7](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2023-12-13) + + +### Bug Fixes + +* **app:** supervisedBy unassigned resolved ([#18](https://github.com/uzh-bf/thesis-platform/issues/18)) ([3f16447](https://github.com/uzh-bf/thesis-platform/commit/3f16447d32921fff9f31d888f86319db054cf50a)) + +## [1.0.0-beta.6](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2023-12-07) + + +### Bug Fixes + +* **solutions:** AreasOfInterestV2 instead of col AreasOfInterest ([#19](https://github.com/uzh-bf/thesis-platform/issues/19)) ([7ea2467](https://github.com/uzh-bf/thesis-platform/commit/7ea246709564405385acdb3a9e0ed81d59ef70af)) + +## [1.0.0-beta.5](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2023-12-07) + + +### Enhancements + +* **solutions:** new thesisMarket topic areas structure and flow secret added to actionable messages ([#17](https://github.com/uzh-bf/thesis-platform/issues/17)) ([b29bc5f](https://github.com/uzh-bf/thesis-platform/commit/b29bc5fbaecf7228133b8a1f09ba3686af5d1945)) + +## [1.0.0-beta.4](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2023-12-05) + + +### Enhancements + +* **app:** show supervisor proposals for all Supervisors but only show applications for owner/supervisor ([#16](https://github.com/uzh-bf/thesis-platform/issues/16)) ([1ea8187](https://github.com/uzh-bf/thesis-platform/commit/1ea818728d5c23f3c376a9a3b049575fbdfe6a8f)) + +## [1.0.0-beta.3](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2023-11-30) + + +### Bug Fixes + +* add rollback migration for timestamps ([d012897](https://github.com/uzh-bf/thesis-platform/commit/d012897468c674bb46ae8bad9483e3c58a55c1e8)) + +## [1.0.0-beta.2](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2023-11-30) + + +### Features + +* implement Proposal Application Acceptance Workflow ([#12](https://github.com/uzh-bf/thesis-platform/issues/12)) ([3cae829](https://github.com/uzh-bf/thesis-platform/commit/3cae829516e416ad8db423d9b37f0b79be4b9f99)) + + +### Bug Fixes + +* **deploy:** env config added ([35607ed](https://github.com/uzh-bf/thesis-platform/commit/35607ed7d6a777a82f499f6b0b528126f40a5365)) +* **deploy:** env config updated ([669a00b](https://github.com/uzh-bf/thesis-platform/commit/669a00bd863697c14763259323ba12b84a60fa90)) +* **deploy:** use APP_URL instead of NEXT_PUBLIC_APP_URL ([2ff4483](https://github.com/uzh-bf/thesis-platform/commit/2ff4483ab9afa37246d13ffff251990001d7ca3f)) +* **prisma:** [@id](https://github.com/id) instead of [@unique](https://github.com/unique) for VerificationToken ([d4d842a](https://github.com/uzh-bf/thesis-platform/commit/d4d842a8ddc89411858c162276dd8da76b86a5af)) + + +### Enhancements + +* **app:** filter & proposalId to url ([#11](https://github.com/uzh-bf/thesis-platform/issues/11)) ([b73f12a](https://github.com/uzh-bf/thesis-platform/commit/b73f12a8b783ae1a6500f06c86d6ef3e82b07f95)) +* **prisma:** timestamps added for feedbacks and supervision ([62cbf0b](https://github.com/uzh-bf/thesis-platform/commit/62cbf0b1e46930cca5fa71e1e76a4e74d9a45c22)) +* **solution:** FlowSecret added for flows with HTTP request and updated solutions folder ([#15](https://github.com/uzh-bf/thesis-platform/issues/15)) ([20815d1](https://github.com/uzh-bf/thesis-platform/commit/20815d11d8813b7360e55c3089ce0b1f5978441e)) + +## [1.0.0-beta.1](https://github.com/uzh-bf/thesis-platform/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2023-11-09) + +## 1.0.0-beta.0 (2023-11-09) + + +### Features + +* add tentative accept form ([a48b0a0](https://github.com/uzh-bf/thesis-platform/commit/a48b0a0b61e69efec9d4b0c15cf299ad2a117bb0)) +* **app:** Proposal filtering ([#7](https://github.com/uzh-bf/thesis-platform/issues/7)) ([9f61c15](https://github.com/uzh-bf/thesis-platform/commit/9f61c1590faadfa65b1b852a78915cfe6024de68)) + + +### Bug Fixes + +* add missing imports ([e477650](https://github.com/uzh-bf/thesis-platform/commit/e47765082006c1243749df610e628340c9890b5a)) +* convert user image to db.Text ([0785ad6](https://github.com/uzh-bf/thesis-platform/commit/0785ad64091982ca5f17f635833ae902b241ae65)) +* decline proposal text adjustment ([5ee2cbc](https://github.com/uzh-bf/thesis-platform/commit/5ee2cbcbf0550fe5dd5e5ecb918cddb2c27cf242)) +* ensure initial active works ([26dd8b9](https://github.com/uzh-bf/thesis-platform/commit/26dd8b9c04faf79a8dedbbd090ba8d9b00ce27de)) +* ensure latest is built only on dev ([874b66c](https://github.com/uzh-bf/thesis-platform/commit/874b66c95f007a2bbfe4de36045302ffd0a93eca)) +* ensure login button is available on supervisor view ([16e9145](https://github.com/uzh-bf/thesis-platform/commit/16e9145ebf2350c0c08f5339c7ae3d20169c03de)) +* make fullName optional ([c091a25](https://github.com/uzh-bf/thesis-platform/commit/c091a258ab070cef83881a25a47697c7817ea2d7)) +* only display azure login if not empty string ([0bfcd11](https://github.com/uzh-bf/thesis-platform/commit/0bfcd1106b7bee3540402a5ddfc9e1a9c09d56fc)) +* push stable in build-stable ([1383cec](https://github.com/uzh-bf/thesis-platform/commit/1383cecfc94da0d6548fca2ff88123b5f930939e)) +* received feedbacks is undefined ([5895a57](https://github.com/uzh-bf/thesis-platform/commit/5895a57834e0d18d899fb2adcf5ffc78b7afac6f)) +* remove doppler dependency from generate command ([5dfffff](https://github.com/uzh-bf/thesis-platform/commit/5dfffff4bfa6d6ee7cc62a30330455fc2d9b9eee)) +* remove embed=true from student and supervisor proposal form ([1e1a55e](https://github.com/uzh-bf/thesis-platform/commit/1e1a55e59cf44499b1a28050d57164f47dbad5f4)) +* restore old package versions for trpc and auth ([fe01dc2](https://github.com/uzh-bf/thesis-platform/commit/fe01dc268558da17e53575a1b3e01250b1c2492a)) +* show auth0 everywhere except production, hide azure login if env not set ([d7be55d](https://github.com/uzh-bf/thesis-platform/commit/d7be55db0404223b03fad74fb02f4b2ff683c988)) +* show full name of student instead of status on card ([17fa54e](https://github.com/uzh-bf/thesis-platform/commit/17fa54ea4164920cfda569eb92b295bce5c7089d)) +* show supervisor name on supervisor proposals ([9222eed](https://github.com/uzh-bf/thesis-platform/commit/9222eede212828d85eb09845199fc6fa79cdddb4)) +* source sans ([f12f63a](https://github.com/uzh-bf/thesis-platform/commit/f12f63adbe33eab0096d7aeaf7dbf893717d9b38)) +* upgrade next-auth ([fcfd058](https://github.com/uzh-bf/thesis-platform/commit/fcfd05856054cca0cda6afa597d724c3bc8e91ad)) +* use AUTH0 if defined ([2075836](https://github.com/uzh-bf/thesis-platform/commit/20758363d59f8a4a6bcc19b9e360bab15cb6dbe4)) +* use different create context ([bee2940](https://github.com/uzh-bf/thesis-platform/commit/bee29401dd0995b8da00eaeec82ab1f5a6612cec)) +* use PROPOSAL_FEEDBACK_URL in backend ([02768fb](https://github.com/uzh-bf/thesis-platform/commit/02768fbaa47c2a62c07e28fd932fdab5d2d45575)) +* use stage as default NODE_ENV ([dc4bc90](https://github.com/uzh-bf/thesis-platform/commit/dc4bc9094157a678007112e5d74e3e38cd316ffa)) + + +### Other + +* .next/ ([d0edb24](https://github.com/uzh-bf/thesis-platform/commit/d0edb2416f42bb3605aee6f5788836f44ae05d82)) +* app / api build command ([0b71866](https://github.com/uzh-bf/thesis-platform/commit/0b7186644f8d80db5a6e1f9dd36605fa2dfe81a3)) +* continued ([0a8c80e](https://github.com/uzh-bf/thesis-platform/commit/0a8c80efe10b7361033456fffdede7e02aa0c483)) +* https removed ([c9d4842](https://github.com/uzh-bf/thesis-platform/commit/c9d484238c2e48cd233ed1b60d9c2a8b361b49b0)) +* https://github.com/Azure/static-web-apps/issues/1034 ([a9b968f](https://github.com/uzh-bf/thesis-platform/commit/a9b968f9482f64223a0703a44ffeb355487e68c4)) +* next export ([e460da7](https://github.com/uzh-bf/thesis-platform/commit/e460da77d424dd8f0aebaf7c3e17cf4376ca8c48)) +* next standalone ([789389e](https://github.com/uzh-bf/thesis-platform/commit/789389ea51dc73f975bc008525b72d263d0e5aeb)) +* production env ([b86a414](https://github.com/uzh-bf/thesis-platform/commit/b86a414ade9517d8d67ea8a16d8ca112a05c9c19)) +* progress ([0957b3d](https://github.com/uzh-bf/thesis-platform/commit/0957b3d400bb1b3371d5473f52af521fbb0e18b3)) +* skip app build ([63f859c](https://github.com/uzh-bf/thesis-platform/commit/63f859c60a3bdb5782f0be161133533bff4d5db4)) +* standalone ([34991c3](https://github.com/uzh-bf/thesis-platform/commit/34991c37c44cec28bb47279b9d63e8ae277090f9)) +* student application form ([6418a8a](https://github.com/uzh-bf/thesis-platform/commit/6418a8a0305fc634d8b80e51106028df51849809)) + + +### Dependencies + +* downgrade next ([c9b1e73](https://github.com/uzh-bf/thesis-platform/commit/c9b1e73fbb59330af16b5144132f63b0e345875e)) +* upgrade all packages ([cd4aef8](https://github.com/uzh-bf/thesis-platform/commit/cd4aef86a98b4cfd6ccb30672640226b869720b1)) +* upgrade next ([ffb56a0](https://github.com/uzh-bf/thesis-platform/commit/ffb56a058543fe9d37c1ed2a4a3c3b18aeefb95d)) +* upgrade prisma and use consistent versions ([5d8f139](https://github.com/uzh-bf/thesis-platform/commit/5d8f1391b5849b59c470331c895cc978da85f908)) +* upgrade to next 13 ([e9502df](https://github.com/uzh-bf/thesis-platform/commit/e9502dfe95e816d0ed5592c93fd3b844f287ecef)) + + +### Deployment + +* add staging deployment script ([8dda251](https://github.com/uzh-bf/thesis-platform/commit/8dda251428191bd707a8571800397e0e1ca64a38)) + + +### Refactors + +* split up into components with props ([#2](https://github.com/uzh-bf/thesis-platform/issues/2)) ([ba3cf3f](https://github.com/uzh-bf/thesis-platform/commit/ba3cf3f6fd0f88fa1178c1584e8d0ca41ec502cd)) + + +### Build and CI + +* add .next/standalone as output_location ([178c6e1](https://github.com/uzh-bf/thesis-platform/commit/178c6e1e91d1be829b134d369e4325f0615df43c)) +* add Azure Static Web Apps workflow file ([1272451](https://github.com/uzh-bf/thesis-platform/commit/1272451d8e9feb3e12de3180591cb50660f30751)) +* add Azure Static Web Apps workflow file ([a5a5b22](https://github.com/uzh-bf/thesis-platform/commit/a5a5b226e6e8363a8b5a8c695ba6d7045aaae06d)) +* add docker build to gitlab ci ([0e493b7](https://github.com/uzh-bf/thesis-platform/commit/0e493b7f0756e190a23936fe6927db0e61d25828)) +* build stable image ([2947cf0](https://github.com/uzh-bf/thesis-platform/commit/2947cf0674714679b40e3dd520b899a389d34de5)) +* comment pull request ([74fa23c](https://github.com/uzh-bf/thesis-platform/commit/74fa23cafe8de813908ec17c84fd330876d664ae)) +* dont replace .env.production ([c0e0db7](https://github.com/uzh-bf/thesis-platform/commit/c0e0db74b5da3de2cc48ebbf4efaa30b0543c928)) +* remove tags in CI ([11f6e9d](https://github.com/uzh-bf/thesis-platform/commit/11f6e9d0fa3913bb7876bf2edf41ff4b81df860c)) +* rename .env.stage to .env.production instead of injecting NODE_ENV ([9102415](https://github.com/uzh-bf/thesis-platform/commit/9102415322ef2fb4db333b46cee997210ed0c9c0)) + + +### Enhancements + +* add time frame to DB schema ([36a1095](https://github.com/uzh-bf/thesis-platform/commit/36a1095be21f74054337feefd4e4bf1ce0912e03)) +* add timeFrame and use proposalId from query to initialize proposal details ([9c55ab7](https://github.com/uzh-bf/thesis-platform/commit/9c55ab7f4a8c118cf4f5cc12a676b8b193b13e56)) +* add very simple footer ([5df0211](https://github.com/uzh-bf/thesis-platform/commit/5df0211e3ce3ab206f108322b41994effbff1b2e)) +* **app:** improve display of application details with modal ([#6](https://github.com/uzh-bf/thesis-platform/issues/6)) ([e897848](https://github.com/uzh-bf/thesis-platform/commit/e89784800fd6d991a46cb2e2c823c49dde5f082e)) +* **app:** store provided feedback in session storage ([#5](https://github.com/uzh-bf/thesis-platform/issues/5)) ([59a034b](https://github.com/uzh-bf/thesis-platform/commit/59a034ba4cd445ce1e6e1352a192527d65d4c933)) +* display existing feedbacks to phds ([0d07b2f](https://github.com/uzh-bf/thesis-platform/commit/0d07b2f1d0d15b3065ea4c46c3fe47a20eefef23)) +* open ms forms in new tab ([cb7ef98](https://github.com/uzh-bf/thesis-platform/commit/cb7ef98673f60c02a08bd1e7059c36ab50ff49b8)) +* **prisma:** make user proposal many-to-many explicit ([f1a690d](https://github.com/uzh-bf/thesis-platform/commit/f1a690dcf5edbcb5377a04b4ef5b65035ae7eb7d)) +* update frontend layout of header and proposal cards ([04b72dc](https://github.com/uzh-bf/thesis-platform/commit/04b72dcf06cc79d07d9df690561a4a2ccfdb03ed)) +* use azure ad and [@db](https://github.com/db).Text ([de0ed77](https://github.com/uzh-bf/thesis-platform/commit/de0ed77a43c1597a8519abd31f017b528bba070e)) diff --git a/README.md b/README.md index 4e9327d..54afd8d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This project serves as a platform to facilitate the creation, management, and vi The motivation behind this project is to offer academic institutions an efficient mechanism to simplify the proposal submission, evaluation, and feedback cycles, thereby facilitating a smoother pairing of students with their respective supervisors. +## Requirements + ## Installation How to install the project: @@ -28,7 +30,85 @@ npm install npm run dev ``` -The web app should now be visible on https://localhost:5000. +The web app should now be visible on . + +### Steps + +## Deployment + +The following instructions will guide you through the deployment process step by step. + +### Pre-requisites + +Your system should have the following installed: + +- [Helm](https://helm.sh/) +- [kubectl](https://kubernetes.io/docs/tasks/tools/) + +### Deployment steps + +Here are the steps you'll need to follow for deployment: + +1. Start in the development environment: + + Run the command `npm run release:beta:dry` to test the setup. + + ```bash + npm run release:beta:dry + ``` + +2. Continue in the development environment: + + Run `npm run release:beta` to start the deployment. + + ```bash + npm run release:beta + ``` + +3. Still within the development environment: + + Push your changes to the dev branch using `git push --follow-tags origin dev`. + + ```bash + git push --follow-tags origin dev + ``` + +4. Switch to Github: + + Actions will automatically generate a new Docker image with a new tag (for example, v1.0.0-beta.1). + +5. Now, move to the `.env/doppler`: + + Update the APP_VERSION environment variable to the new tag (for example, v1.0.0-beta.1). + +6. Go back to the development environment: + + Navigate to the deploy directory using `cd deploy/`. + + ```bash + cd deploy/ + ``` + +7. Check the changes with `./_deploy_prod.sh diff`. + + ```bash + ./_deploy_prod.sh diff + ``` + +8. Apply the changes to the production environment using `./_deploy_prod.sh apply`. + + ```bash + ./_deploy_prod.sh apply + ``` + +9. Your new version is now deployed to the production environment on [https://theses.bf.uzh.ch/](https://theses.bf.uzh.ch/). + +### Restart the app (if only Powerautomate Solution Update) + +```bash +# Restart the app +kubectl rollout restart -n thesis-platform deployment thesis-platform +``` ## Contributing diff --git a/deploy/chart/templates/secret.yaml b/deploy/chart/templates/secret.yaml index 6ba19a2..1a6a837 100644 --- a/deploy/chart/templates/secret.yaml +++ b/deploy/chart/templates/secret.yaml @@ -6,6 +6,7 @@ metadata: {{- include "thesis-platform.labels" . | nindent 4 }} type: Opaque stringData: + FLOW_SECRET: {{ .Values.flows.secret | quote }} AUTH0_CLIENT_SECRET: {{ .Values.auth0.clientSecret | quote }} AZURE_AD_CLIENT_SECRET: {{ .Values.azureAd.clientSecret | quote }} AZURE_STORAGE_ACCOUNT_ACCESS_KEY: {{ .Values.azureBlob.accessKey | quote }} @@ -13,3 +14,4 @@ stringData: NEXTAUTH_SECRET: {{ .Values.appSecret | quote }} APPLICATION_URL: {{ .Values.flows.application | quote }} PROPOSAL_FEEDBACK_URL: {{ .Values.flows.proposalFeedback | quote }} + APPLICATION_ACCEPTANCE_URL: {{ .Values.flows.applicationAcceptance | quote }} \ No newline at end of file diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index c06e653..ad0eddb 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -19,14 +19,16 @@ database: appSecret: "" flows: + secret: "" application: "" proposalFeedback: "" + applicationAcceptance: "" replicaCount: 1 image: repository: ghcr.io/uzh-bf/thesis-platform - tag: main + tag: dev pullPolicy: Always service: diff --git a/deploy/helmfile.yaml b/deploy/helmfile.yaml index e36a6a8..a3f3d60 100644 --- a/deploy/helmfile.yaml +++ b/deploy/helmfile.yaml @@ -8,19 +8,21 @@ releases: kubeContext: bf-k8s463ba113 values: - appSecret: '{{ requiredEnv "NEXTAUTH_SECRET" }}' - appUrl: '{{ requiredEnv "NEXT_PUBLIC_APP_URL" }}' + appUrl: '{{ requiredEnv "APP_URL" }}' image: tag: '{{ requiredEnv "APP_VERSION" }}' flows: + secret: '{{ requiredEnv "FLOW_SECRET" }}' application: '{{ requiredEnv "APPLICATION_URL" }}' proposalFeedback: '{{ requiredEnv "PROPOSAL_FEEDBACK_URL" }}' + applicationAcceptance: '{{ requiredEnv "APPLICATION_ACCEPTANCE_URL" }}' azureAd: - clientId: '{{ requiredEnv "AZURE_AD_CLIENT_ID" }}' - clientSecret: '{{ requiredEnv "AZURE_AD_CLIENT_SECRET" }}' - tenantId: '{{ requiredEnv "AZURE_AD_TENANT_ID" }}' + clientId: '{{ env "AZURE_AD_CLIENT_ID" }}' + clientSecret: '{{ env "AZURE_AD_CLIENT_SECRET" }}' + tenantId: '{{ env "AZURE_AD_TENANT_ID" }}' auth0: clientId: '{{ env "AUTH0_CLIENT_ID" }}' diff --git a/package-lock.json b/package-lock.json index 75a5912..7440cff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@uzh-bf/thesis-platform", - "version": "0.0.1", + "version": "1.0.0-beta.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@uzh-bf/thesis-platform", - "version": "0.0.1", + "version": "1.0.0-beta.12", "dependencies": { "@azure/identity": "3.3.0", "@azure/storage-blob": "12.15.0", @@ -22,7 +22,8 @@ "@trpc/next": "10.37.1", "@trpc/react-query": "10.37.1", "@trpc/server": "10.37.1", - "@uzh-bf/design-system": "2.0.12", + "@uidotdev/usehooks": "2.4.1", + "@uzh-bf/design-system": "2.4.3", "axios": "1.5.1", "cross-fetch": "3.1.5", "date-fns": "2.30.0", @@ -2425,10 +2426,22 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@uidotdev/usehooks": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.4.1.tgz", + "integrity": "sha512-1I+RwWyS+kdv3Mv0Vmc+p0dPYH0DTRAo04HLyXReYBL9AeseDWUJyi4THuksBJcu9F0Pih69Ak150VDnqbVnXg==", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "react": ">=18.0.0", + "react-dom": ">=18.0.0" + } + }, "node_modules/@uzh-bf/design-system": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/@uzh-bf/design-system/-/design-system-2.0.12.tgz", - "integrity": "sha512-wR0Y/RLEjXdMcidYx+06V7hZl+EwigpEwjl4yRVsoKgUL+kY9jmpJWOx6m1vOj5d0gF7JwFi4DJUp/Ysn5YQ1A==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@uzh-bf/design-system/-/design-system-2.4.3.tgz", + "integrity": "sha512-xNJ5ktGIPfe6aXiB7qdidNl9+RUhmSh3OWlJvSTqrqjinL7NsAK02uA8FpkMO0xdWOAuQAKiXLUjCoWwLRIaFg==", "dependencies": { "@radix-ui/react-checkbox": "1.0.4", "@radix-ui/react-collapsible": "1.0.3", @@ -2444,7 +2457,7 @@ "@radix-ui/react-toast": "1.1.4", "@radix-ui/react-tooltip": "1.0.6", "react-colorful": "5.6.1", - "react-countdown-circle-timer": "3.2.1" + "react-countdown": "2.3.5" }, "engines": { "node": ">=16" @@ -7571,12 +7584,16 @@ "react-dom": ">=16.8.0" } }, - "node_modules/react-countdown-circle-timer": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/react-countdown-circle-timer/-/react-countdown-circle-timer-3.2.1.tgz", - "integrity": "sha512-yBAy/9ILXOiFbLBM+3jS72TW5LeRcH8wkRC9NNqMpUkCXkGjSnaeRbJMsR9lsYF0oVXjSDbJaRbCuVMT+9HnKA==", + "node_modules/react-countdown": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/react-countdown/-/react-countdown-2.3.5.tgz", + "integrity": "sha512-K26ENYEesMfPxhRRtm1r+Pf70SErrvW3g4CArLi/x6MPFjgfDFYePT4UghEj8p2nI0cqVV7/JjDgjyr//U60Og==", + "dependencies": { + "prop-types": "^15.7.2" + }, "peerDependencies": { - "react": ">=16.8.0" + "react": ">= 15", + "react-dom": ">= 15" } }, "node_modules/react-dom": { diff --git a/package.json b/package.json index 656e3a0..9a3a71e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@uzh-bf/thesis-platform", - "version": "0.0.1", + "version": "1.0.0-beta.12", "private": true, "scripts": { "prebuild": "npm run prisma:generate", @@ -47,7 +47,8 @@ "@trpc/next": "10.37.1", "@trpc/react-query": "10.37.1", "@trpc/server": "10.37.1", - "@uzh-bf/design-system": "2.0.12", + "@uidotdev/usehooks": "2.4.1", + "@uzh-bf/design-system": "2.4.3", "axios": "1.5.1", "cross-fetch": "3.1.5", "date-fns": "2.30.0", diff --git a/prisma/migrations/20231129153924_supervision_feedback_timestamps/migration.sql b/prisma/migrations/20231129153924_supervision_feedback_timestamps/migration.sql new file mode 100644 index 0000000..6a95849 --- /dev/null +++ b/prisma/migrations/20231129153924_supervision_feedback_timestamps/migration.sql @@ -0,0 +1,7 @@ +-- AlterTable +ALTER TABLE `userproposalfeedback` ADD COLUMN `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + ADD COLUMN `updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3); + +-- AlterTable +ALTER TABLE `userproposalsupervision` ADD COLUMN `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + ADD COLUMN `updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3); diff --git a/prisma/migrations/20231129155942_verification_token_id/migration.sql b/prisma/migrations/20231129155942_verification_token_id/migration.sql new file mode 100644 index 0000000..0d7a22a --- /dev/null +++ b/prisma/migrations/20231129155942_verification_token_id/migration.sql @@ -0,0 +1,14 @@ +/* + Warnings: + + - The primary key for the `verificationtoken` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `my_row_id` on the `verificationtoken` table. All the data in the column will be lost. + +*/ +-- DropIndex +DROP INDEX `VerificationToken_identifier_token_key` ON `verificationtoken`; + +-- AlterTable +ALTER TABLE `verificationtoken` DROP PRIMARY KEY, + DROP COLUMN `my_row_id`, + ADD PRIMARY KEY (`identifier`, `token`); diff --git a/prisma/migrations/20231130091916_remove_timestamps/migration.sql b/prisma/migrations/20231130091916_remove_timestamps/migration.sql new file mode 100644 index 0000000..33f7725 --- /dev/null +++ b/prisma/migrations/20231130091916_remove_timestamps/migration.sql @@ -0,0 +1,16 @@ +/* + Warnings: + + - You are about to drop the column `createdAt` on the `userproposalfeedback` table. All the data in the column will be lost. + - You are about to drop the column `updatedAt` on the `userproposalfeedback` table. All the data in the column will be lost. + - You are about to drop the column `createdAt` on the `userproposalsupervision` table. All the data in the column will be lost. + - You are about to drop the column `updatedAt` on the `userproposalsupervision` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE `userproposalfeedback` DROP COLUMN `createdAt`, + DROP COLUMN `updatedAt`; + +-- AlterTable +ALTER TABLE `userproposalsupervision` DROP COLUMN `createdAt`, + DROP COLUMN `updatedAt`; \ No newline at end of file diff --git a/prisma/migrations/20231214082817_add_timestamps/migration.sql b/prisma/migrations/20231214082817_add_timestamps/migration.sql new file mode 100644 index 0000000..6a95849 --- /dev/null +++ b/prisma/migrations/20231214082817_add_timestamps/migration.sql @@ -0,0 +1,7 @@ +-- AlterTable +ALTER TABLE `userproposalfeedback` ADD COLUMN `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + ADD COLUMN `updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3); + +-- AlterTable +ALTER TABLE `userproposalsupervision` ADD COLUMN `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + ADD COLUMN `updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3); diff --git a/prisma/migrations/20240117090934_admin_table/migration.sql b/prisma/migrations/20240117090934_admin_table/migration.sql new file mode 100644 index 0000000..b75acc6 --- /dev/null +++ b/prisma/migrations/20240117090934_admin_table/migration.sql @@ -0,0 +1,19 @@ +-- CreateTable +CREATE TABLE `AdminInfo` ( + `id` VARCHAR(191) NOT NULL, + `mailReceived` VARCHAR(191) NULL, + `supervisor` VARCHAR(191) NULL, + `student` VARCHAR(191) NULL, + `title` VARCHAR(191) NULL, + `type` VARCHAR(191) NULL, + `status` VARCHAR(191) NULL, + `olatCapturedDate` DATETIME(3) NULL, + `submissionDate` DATETIME(3) NULL, + `grade` DOUBLE NULL, + `olatGradeDate` DATETIME(3) NULL, + `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + `updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + + UNIQUE INDEX `AdminInfo_id_key`(`id`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/prisma/migrations/20240227081238_additional_student_comment/migration.sql b/prisma/migrations/20240227081238_additional_student_comment/migration.sql new file mode 100644 index 0000000..e141f32 --- /dev/null +++ b/prisma/migrations/20240227081238_additional_student_comment/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `proposal` ADD COLUMN `additionalStudentComment` TEXT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 91196e0..11e26ba 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -55,7 +55,7 @@ model VerificationToken { token String @unique expires DateTime - @@unique([identifier, token]) + @@id([identifier, token]) } model User { @@ -123,6 +123,7 @@ model Proposal { language String studyLevel String timeFrame String? + additionalStudentComment String? @db.Text topicArea TopicArea @relation(fields: [topicAreaSlug], references: [slug]) topicAreaSlug String @@ -186,6 +187,9 @@ model UserProposalSupervision { studentEmail String? studyLevel String? + + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt } model UserProposalFeedback { @@ -203,5 +207,26 @@ model UserProposalFeedback { reason String comment String @db.Text + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt + @@unique([proposalId, userEmail]) } + +model AdminInfo { + id String @id @unique @default(uuid()) + + mailReceived String? + supervisor String? + student String? + title String? + type String? + status String? + olatCapturedDate DateTime? + submissionDate DateTime? + grade Float? + olatGradeDate DateTime? + + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt +} \ No newline at end of file diff --git a/prisma/seed.ts b/prisma/seed.ts index 2701302..c28f4d2 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -73,7 +73,7 @@ async function seed(prisma: PrismaClient) { ) await new Promise((resolve) => - rl.question('Please sign-in with Azure AD before continuing...', (ans) => { + rl.question('Please sign-in before continuing...', (ans) => { rl.close() resolve(ans) }) @@ -87,177 +87,177 @@ async function seed(prisma: PrismaClient) { }, }) - await prisma.proposal.upsert({ - where: { id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f' }, - create: { - id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f', - title: 'Effects of Interest Rate on Happiness', - description: 'This is a very interesting topic', - language: '["English"]', - studyLevel: 'Master Thesis (30 ECTS)', - topicArea: { - connect: { - slug: 'sustainable_finance', - }, - }, - status: { - connect: { key: ProposalStatus.OPEN }, - }, - type: { - connect: { key: ProposalType.STUDENT }, - }, - applications: { - create: { - email: 'roland.ferdinand@uzh.ch', - plannedStartAt: new Date(), - fullName: 'Roland Ferdinand', - matriculationNumber: '12-345-678', - motivation: 'I want to', - }, - }, - ownedByStudent: 'roland.ferdinand@uzh.ch', - ownedByUser: { - connect: { email: user.email }, - }, - receivedFeedbacks: { - create: { - comment: 'Rejected because', - type: { - connect: { key: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC }, - }, - reason: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC, - user: { - connect: { email: user.email }, - }, - }, - }, - }, - update: {}, - }) + // await prisma.proposal.upsert({ + // where: { id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f' }, + // create: { + // id: '3ef84a3b-cff0-4350-b760-4c5bb3b3c98f', + // title: 'Effects of Interest Rate on Happiness', + // description: 'This is a very interesting topic', + // language: '["English"]', + // studyLevel: 'Master Thesis (30 ECTS)', + // topicArea: { + // connect: { + // slug: 'sustainable_finance', + // }, + // }, + // status: { + // connect: { key: ProposalStatus.OPEN }, + // }, + // type: { + // connect: { key: ProposalType.STUDENT }, + // }, + // applications: { + // create: { + // email: 'roland.ferdinand@uzh.ch', + // plannedStartAt: new Date(), + // fullName: 'Roland Ferdinand', + // matriculationNumber: '12-345-678', + // motivation: 'I want to', + // }, + // }, + // ownedByStudent: 'roland.ferdinand@uzh.ch', + // ownedByUser: { + // connect: { email: user.email }, + // }, + // receivedFeedbacks: { + // create: { + // comment: 'Rejected because', + // type: { + // connect: { key: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC }, + // }, + // reason: ProposalFeedbackType.REJECTED_NOT_SCIENTIFIC, + // user: { + // connect: { email: user.email }, + // }, + // }, + // }, + // }, + // update: {}, + // }) - await prisma.proposal.upsert({ - where: { id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6' }, - create: { - id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6', - title: - 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages', - description: - 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages', - language: '["English", "German"]', - studyLevel: 'Master Thesis (30 ECTS)', - timeFrame: 'Sometime next year.', - topicArea: { - connect: { - slug: 'banking_and_insurance', - }, - }, - status: { - connect: { key: ProposalStatus.OPEN }, - }, - type: { - connect: { key: ProposalType.SUPERVISOR }, - }, - supervisedBy: { - create: { - supervisor: { - connect: { email: user.email }, - }, - }, - }, - ownedByUser: { - connect: { email: user.email }, - }, - applications: { - create: { - plannedStartAt: new Date(), - email: 'roland.ferdinand@uzh.ch', - fullName: 'Roland Ferdinand', - matriculationNumber: '12-345-678', - motivation: - 'I want to do this topic as I think it is very interesting.', - attachments: { - createMany: { - data: [ - { - name: 'CV.pdf', - href: 'https://example.com/cv.pdf', - type: 'application/pdf', - }, - { - name: 'Transcript.pdf', - href: 'https://example.com/cv.pdf', - type: 'application/pdf', - }, - ], - }, - }, - }, - }, - }, - update: {}, - }) + // await prisma.proposal.upsert({ + // where: { id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6' }, + // create: { + // id: '33a9a1b7-cad7-46e7-8b72-cfcbdbaa60d6', + // title: + // 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages', + // description: + // 'The role of interest rate expectations for the choice between Fixed-Rate Mortgages and Adjustable-Rate Mortgages', + // language: '["English", "German"]', + // studyLevel: 'Master Thesis (30 ECTS)', + // timeFrame: 'Sometime next year.', + // topicArea: { + // connect: { + // slug: 'banking_and_insurance', + // }, + // }, + // status: { + // connect: { key: ProposalStatus.OPEN }, + // }, + // type: { + // connect: { key: ProposalType.SUPERVISOR }, + // }, + // supervisedBy: { + // create: { + // supervisor: { + // connect: { email: user.email }, + // }, + // }, + // }, + // ownedByUser: { + // connect: { email: user.email }, + // }, + // applications: { + // create: { + // plannedStartAt: new Date(), + // email: 'roland.ferdinand@uzh.ch', + // fullName: 'Roland Ferdinand', + // matriculationNumber: '12-345-678', + // motivation: + // 'I want to do this topic as I think it is very interesting.', + // attachments: { + // createMany: { + // data: [ + // { + // name: 'CV.pdf', + // href: 'https://example.com/cv.pdf', + // type: 'application/pdf', + // }, + // { + // name: 'Transcript.pdf', + // href: 'https://example.com/cv.pdf', + // type: 'application/pdf', + // }, + // ], + // }, + // }, + // }, + // }, + // }, + // update: {}, + // }) - await prisma.proposal.upsert({ - where: { id: '21140e2e-e630-494a-ab18-374fd11c62c0' }, - create: { - id: '21140e2e-e630-494a-ab18-374fd11c62c0', - title: - 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz', - description: - 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz', - language: '["English"]', - studyLevel: 'Master Thesis (30 ECTS)', - timeFrame: '2023', - topicArea: { - connect: { - slug: 'financial_economics', - }, - }, - status: { - connect: { key: ProposalStatus.OPEN }, - }, - type: { - connect: { key: ProposalType.SUPERVISOR }, - }, - supervisedBy: { - create: { - supervisor: { - connect: { email: user.email }, - }, - }, - }, - ownedByUser: { - connect: { email: user.email }, - }, - applications: { - create: { - plannedStartAt: new Date(), - email: 'roland.ferdinand@uzh.ch', - fullName: 'Roland Ferdinand', - matriculationNumber: '12-345-678', - motivation: - 'I want to do this topic as I think it is very interesting.', - attachments: { - createMany: { - data: [ - { - name: 'CV.pdf', - href: 'https://example.com/cv.pdf', - type: 'application/pdf', - }, - { - name: 'Transcript.pdf', - href: 'https://example.com/cv.pdf', - type: 'application/pdf', - }, - ], - }, - }, - }, - }, - }, - update: {}, - }) + // await prisma.proposal.upsert({ + // where: { id: '21140e2e-e630-494a-ab18-374fd11c62c0' }, + // create: { + // id: '21140e2e-e630-494a-ab18-374fd11c62c0', + // title: + // 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz', + // description: + // 'Treiber der Inflation in der Schweiz / Inflationsmessung in der Schweiz', + // language: '["English"]', + // studyLevel: 'Master Thesis (30 ECTS)', + // timeFrame: '2023', + // topicArea: { + // connect: { + // slug: 'financial_economics', + // }, + // }, + // status: { + // connect: { key: ProposalStatus.OPEN }, + // }, + // type: { + // connect: { key: ProposalType.SUPERVISOR }, + // }, + // supervisedBy: { + // create: { + // supervisor: { + // connect: { email: user.email }, + // }, + // }, + // }, + // ownedByUser: { + // connect: { email: user.email }, + // }, + // applications: { + // create: { + // plannedStartAt: new Date(), + // email: 'roland.ferdinand@uzh.ch', + // fullName: 'Roland Ferdinand', + // matriculationNumber: '12-345-678', + // motivation: + // 'I want to do this topic as I think it is very interesting.', + // attachments: { + // createMany: { + // data: [ + // { + // name: 'CV.pdf', + // href: 'https://example.com/cv.pdf', + // type: 'application/pdf', + // }, + // { + // name: 'Transcript.pdf', + // href: 'https://example.com/cv.pdf', + // type: 'application/pdf', + // }, + // ], + // }, + // }, + // }, + // }, + // }, + // update: {}, + // }) } seed(prismaClient) diff --git a/solutions/UZHBFThesisPlatform.zip b/solutions/UZHBFThesisPlatform.zip index e7cc78f..99b1006 100644 Binary files a/solutions/UZHBFThesisPlatform.zip and b/solutions/UZHBFThesisPlatform.zip differ diff --git a/solutions/UZHBFThesisPlatform/Other/Customizations.xml b/solutions/UZHBFThesisPlatform/Other/Customizations.xml new file mode 100644 index 0000000..811e275 --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Other/Customizations.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + Azure Blob Reference + /providers/Microsoft.PowerApps/apis/shared_azureblob + 1 + 0 + 1 + + + Forms Reference + /providers/Microsoft.PowerApps/apis/shared_microsoftforms + 1 + 0 + 1 + + + Mail Reference + /providers/Microsoft.PowerApps/apis/shared_sendmail + 1 + 0 + 1 + + + OneDrive Reference + /providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness + 1 + 0 + 1 + + + Outlook 365 Reference + /providers/Microsoft.PowerApps/apis/shared_office365 + 1 + 0 + 1 + + + SharePoint Reference + /providers/Microsoft.PowerApps/apis/shared_sharepointonline + 1 + 0 + 1 + + + SQL Reference + /providers/Microsoft.PowerApps/apis/shared_azuremysql + 1 + 0 + 1 + + + + 1033 + + \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/solution.xml b/solutions/UZHBFThesisPlatform/Other/Solution.xml similarity index 94% rename from solutions/UZHBFThesisPlatform/solution.xml rename to solutions/UZHBFThesisPlatform/Other/Solution.xml index f9d761f..6487814 100644 --- a/solutions/UZHBFThesisPlatform/solution.xml +++ b/solutions/UZHBFThesisPlatform/Other/Solution.xml @@ -1,87 +1,89 @@ - - - UZHBFThesisPlatform - - - - - 0.0.0.4 - 0 - - UZHBF - - - - - - https://www.bf.uzh.ch - uzhbf - 81783 - -
- 1 - 1 - - - - - - - - - - - - - - - - 1 - - - - - - - - -
-
- 2 - 1 - - - - - - - - - - - - - - - - 1 - - - - - - - - -
-
-
- - - - - - - -
+ + + + UZHBFThesisPlatform + + + + + 0.0.0.4 + 2 + + UZHBF + + + + + + https://www.bf.uzh.ch + uzhbf + 81783 + +
+ 1 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+ 2 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+
+ + + + + + + + +
\ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json new file mode 100644 index 0000000..0fe13e3 --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json @@ -0,0 +1,577 @@ +{ + "properties": { + "connectionReferences": { + "shared_azuremysql": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_sql_ref" + }, + "api": { + "name": "shared_azuremysql" + } + }, + "shared_office365": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_outlook365_ref" + }, + "api": { + "name": "shared_office365" + } + }, + "shared_sendmail-2": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_mail_ref" + }, + "api": { + "name": "shared_sendmail" + } + } + }, + "definition": { + "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "$connections": { + "defaultValue": {}, + "type": "Object" + }, + "$authentication": { + "defaultValue": {}, + "type": "SecureObject" + }, + "Environment (uzhbf_thesisplatform_environment_env_var)": { + "defaultValue": "DEV", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_environment_env_var" + } + }, + "Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)": { + "defaultValue": "flow@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_email_failure_env_var" + } + }, + "Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)": { + "defaultValue": "maximilian.weber@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_outlook_from_address_env_var" + } + }, + "Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)": { + "defaultValue": "maximilian.weber@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_thesis_inbox_env_var" + } + }, + "Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)": { + "defaultValue": "abcd", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_flow_secret_env_var" + } + }, + "Department (uzhbf_thesisplatform_department_env_var)": { + "defaultValue": "DBF", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_department_env_var" + } + } + }, + "triggers": { + "manual": { + "metadata": { + "operationMetadataId": "1c77e3d6-3094-4200-b0d9-961cba7869ca" + }, + "type": "Request", + "kind": "Http", + "inputs": { + "schema": { + "type": "object", + "properties": { + "proposalId": { + "type": "string" + }, + "proposalApplicationId": { + "type": "string" + }, + "applicantEmail": { + "type": "string" + } + } + }, + "triggerAuthenticationType": "All" + }, + "conditions": [] + } + }, + "actions": { + "Try": { + "actions": { + "UpdateProposalMatched": { + "runAfter": { + "GetProposalInfo": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b16d2167-065d-479e-bb4d-9792c4e41f51" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "id": "@triggerBody()?['proposalId']", + "item/createdAt": "@outputs('GetProposalInfo')?['body/createdAt']", + "item/description": "@outputs('GetProposalInfo')?['body/description']", + "item/language": "@outputs('GetProposalInfo')?['body/language']", + "item/statusKey": "MATCHED", + "item/studyLevel": "@outputs('GetProposalInfo')?['body/studyLevel']", + "item/title": "@outputs('GetProposalInfo')?['body/title']", + "item/topicAreaSlug": "@outputs('GetProposalInfo')?['body/topicAreaSlug']", + "item/typeKey": "@outputs('GetProposalInfo')?['body/typeKey']", + "item/updatedAt": "@utcNow()", + "item/ownedByStudent": "@outputs('GetProposalInfo')?['body/ownedByStudent']", + "item/ownedByUserEmail": "@outputs('GetProposalInfo')?['body/ownedByUserEmail']", + "item/timeFrame": "@outputs('GetProposalInfo')?['body/timeFrame']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "GetUserProposalSupervisionInfo": { + "runAfter": { + "UpdateProposalMatched": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "63daa442-83a1-4ed0-95fa-d8b2ed6fe0f4" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "id": "@triggerBody()?['proposalId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "UpdateUserProposalSupervisionStudentEmail": { + "runAfter": { + "GetUserProposalSupervisionInfo": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "a946287f-1a21-4d92-95e7-a21dc927e738" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "id": "@triggerBody()?['proposalId']", + "item/createdAt": "@outputs('GetUserProposalSupervisionInfo')?['body/createdAt']", + "item/proposalId": "@outputs('GetUserProposalSupervisionInfo')?['body/proposalId']", + "item/updatedAt": "@utcNow()", + "item/studentEmail": "@triggerBody()?['applicantEmail']", + "item/studyLevel": "@outputs('GetUserProposalSupervisionInfo')?['body/studyLevel']", + "item/supervisorEmail": "@outputs('GetUserProposalSupervisionInfo')?['body/supervisorEmail']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "GetProposalApplicationInfo": { + "runAfter": { + "UpdateUserProposalSupervisionStudentEmail": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bd966497-1196-4e6d-a954-bcac82c25a74" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "id": "@triggerBody()?['proposalApplicationId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "UpdateProposalApplicationAccepted": { + "runAfter": { + "GetProposalApplicationInfo": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6120af66-b299-4cd8-acd2-88a3d16d415d" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "id": "@triggerBody()?['proposalApplicationId']", + "item/createdAt": "@outputs('GetProposalApplicationInfo')?['body/createdAt']", + "item/email": "@outputs('GetProposalApplicationInfo')?['body/email']", + "item/fullName": "@outputs('GetProposalApplicationInfo')?['body/fullName']", + "item/matriculationNumber": "@outputs('GetProposalApplicationInfo')?['body/matriculationNumber']", + "item/motivation": "@outputs('GetProposalApplicationInfo')?['body/motivation']", + "item/plannedStartAt": "@outputs('GetProposalApplicationInfo')?['body/plannedStartAt']", + "item/proposalId": "@outputs('GetProposalApplicationInfo')?['body/proposalId']", + "item/statusKey": "ACCEPTED", + "item/updatedAt": "@utcNow()", + "item/supervisionId": "@triggerBody()?['proposalId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "GetProposalApplicationsToDecline": { + "runAfter": { + "UpdateProposalApplicationAccepted": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "f242d66b-b23c-4821-a6e9-102375f81242" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "$filter": "proposalId eq '@{triggerBody()?['proposalId']}' and email ne '@{triggerBody()?['applicantEmail']}'" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Apply_to_each": { + "foreach": "@outputs('GetProposalApplicationsToDecline')?['body/value']", + "actions": { + "UpdateProposalApplicationDeclined": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "2598e0d2-d6a3-496b-acf6-eb2f24cc1acd" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "id": "@items('Apply_to_each')?['id']", + "item/createdAt": "@items('Apply_to_each')?['createdAt']", + "item/email": "@items('Apply_to_each')?['email']", + "item/fullName": "@items('Apply_to_each')?['fullName']", + "item/matriculationNumber": "@items('Apply_to_each')?['matriculationNumber']", + "item/motivation": "@items('Apply_to_each')?['motivation']", + "item/plannedStartAt": "@items('Apply_to_each')?['plannedStartAt']", + "item/proposalId": "@items('Apply_to_each')?['proposalId']", + "item/statusKey": "DECLINED", + "item/updatedAt": "@utcNow()", + "item/supervisionId": "@null" + }, + "authentication": "@parameters('$authentication')" + } + }, + "DeclineApplicantNotification": { + "runAfter": { + "UpdateProposalApplicationDeclined": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "33021eda-e781-4cdf-838e-7280251ec03f" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@outputs('UpdateProposalApplicationDeclined')?['body/email']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Proposal Application Declined", + "emailMessage/Body": "

Dear @{outputs('UpdateProposalApplicationDeclined')?['body/fullName']},
\n
\nWe are sorry to inform you, that your application on the proposal \"@{outputs('GetProposalInfo')?['body/title']}\" was declined.
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator

", + "emailMessage/From": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": { + "GetProposalApplicationsToDecline": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5ae870fc-77a2-4074-844a-5d1ef4da9f2b" + }, + "type": "Foreach" + }, + "GetProposalInfo": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "8db4975b-3fdf-4b60-a02f-5781177d3524" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "id": "@triggerBody()?['proposalId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "AcceptApplicantNotification": { + "runAfter": { + "Apply_to_each": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c770ade3-7921-45b3-802e-c0c6af531b87" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@triggerBody()?['applicantEmail']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Proposal Application Accepted", + "emailMessage/Body": "

Dear @{outputs('UpdateProposalApplicationAccepted')?['body/fullName']},
\n
\nYour application to the proposal \"@{outputs('UpdateProposalMatched')?['body/title']}\", was accepted by @{outputs('UpdateUserProposalSupervisionStudentEmail')?['body/supervisorEmail']}.
\nKindly get in touch with your supervisor by replying to this email within one week.
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator

", + "emailMessage/From": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/Cc": "@{parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')};@{outputs('UpdateUserProposalSupervisionStudentEmail')?['body/supervisorEmail']}", + "emailMessage/ReplyTo": "@outputs('UpdateUserProposalSupervisionStudentEmail')?['body/supervisorEmail']", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Response": { + "runAfter": { + "AcceptApplicantNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "683d1d81-839c-4789-b0f5-5246ea53241d" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "Content-Type": "application/json" + }, + "body": { + "message": "success" + } + } + } + }, + "runAfter": { + "IsFLowSecretCorrect": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e7d8a472-e6f6-4fed-9b99-4c9f7109fc71" + }, + "type": "Scope" + }, + "Catch": { + "actions": { + "FilterForFailedOrTimedOutStatus": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "ca1bedd8-7555-4a99-a290-1c22c2e6e229" + }, + "type": "Query", + "inputs": { + "from": "@result('Try')", + "where": "@or(equals(item()?['Status'], 'Failed'), equals(item()?['Status'], 'TimedOut'))" + } + }, + "CreateHtmlTable": { + "runAfter": { + "FilterForFailedOrTimedOutStatus": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "34b6a96f-64c6-43fd-89a3-fe7d5ef245ff" + }, + "type": "Table", + "inputs": { + "from": "@body('FilterForFailedOrTimedOutStatus')", + "format": "HTML", + "columns": [ + { + "header": "ProposalId", + "value": "@triggerBody()?['proposalId']" + }, + { + "header": "proposalApplicationId", + "value": "@triggerBody()?['proposalApplicationId']" + }, + { + "header": "applicantEmail", + "value": "@triggerBody()?['applicantEmail']" + }, + { + "header": "ErrorCode", + "value": "@item()?['code']" + } + ] + } + }, + "Terminate": { + "runAfter": { + "SendFailureNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0f41eff7-41db-4eae-8e12-46f64d545e8b" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + }, + "SendFailureNotification": { + "runAfter": { + "CreateHtmlTable": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e7c370de-36de-45b2-ae99-b7d0e7013242" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sendmail-2", + "operationId": "SendEmailV3", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sendmail" + }, + "parameters": { + "request/to": "@{parameters('Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)')};", + "request/subject": "(@{parameters('Environment (uzhbf_thesisplatform_environment_env_var)')}) Failure in UZH BF Thesis Platform - Thesis Application Acceptance", + "request/text": "

@{body('CreateHtmlTable')}

" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": { + "Try": [ + "TimedOut", + "Failed" + ] + }, + "metadata": { + "operationMetadataId": "054f28a3-080c-4f8a-9529-1183121f12f9" + }, + "type": "Scope" + }, + "IsFLowSecretCorrect": { + "actions": {}, + "runAfter": {}, + "else": { + "actions": { + "Terminate_2": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "b0e5bdca-638d-4f99-bf6a-88e22b939ecb" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + } + } + }, + "expression": { + "equals": [ + "@triggerOutputs()['headers']['secretKey']", + "@parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')" + ] + }, + "metadata": { + "operationMetadataId": "2e8497de-b65d-41bd-bc3e-8d913d2aba3c" + }, + "type": "If" + } + }, + "outputs": {} + }, + "templateName": "" + }, + "schemaVersion": "1.0.0.0" +} \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json.data.xml b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json.data.xml new file mode 100644 index 0000000..437373d --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/UZHBFThesisPlatform-ThesisApplicationAcceptance-7C987104-6984-EE11-8179-002248DB4B50.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 0.0.0.4 + 1 + 0 + 1 + none + + + + \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json index 0bab030..280b2a8 100644 --- a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json @@ -10,22 +10,22 @@ "name": "shared_azureblob" } }, - "shared_azuremysql": { + "shared_sharepointonline": { "runtimeSource": "embedded", "connection": { - "connectionReferenceLogicalName": "uzhbf_thesisplatform_sql_ref" + "connectionReferenceLogicalName": "uzhbf_thesisplatform_sharePoint_ref" }, "api": { - "name": "shared_azuremysql" + "name": "shared_sharepointonline" } }, - "shared_sharepointonline": { + "shared_azuremysql": { "runtimeSource": "embedded", "connection": { - "connectionReferenceLogicalName": "uzhbf_thesisplatform_sharePoint_ref" + "connectionReferenceLogicalName": "uzhbf_thesisplatform_sql_ref" }, "api": { - "name": "shared_sharepointonline" + "name": "shared_azuremysql" } }, "shared_office365_1": { @@ -36,6 +36,15 @@ "api": { "name": "shared_office365" } + }, + "shared_sendmail-2": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_mail_ref" + }, + "api": { + "name": "shared_sendmail" + } } }, "definition": { @@ -77,6 +86,34 @@ "metadata": { "schemaName": "uzhbf_thesisplatform_proposals_document_library_name_env_var" } + }, + "Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)": { + "defaultValue": "flow@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_email_failure_env_var" + } + }, + "Environment (uzhbf_thesisplatform_environment_env_var)": { + "defaultValue": "DEV", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_environment_env_var" + } + }, + "Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)": { + "defaultValue": "abcd", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_flow_secret_env_var" + } + }, + "Department (uzhbf_thesisplatform_department_env_var)": { + "defaultValue": "DBF", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_department_env_var" + } } }, "triggers": { @@ -178,363 +215,569 @@ "type": "object" }, "triggerAuthenticationType": "All" - } + }, + "conditions": [] } }, "actions": { - "GetCvFile": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "bb3743dd-d6ee-4df7-98fb-a803dc4475db" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azureblob_1", - "operationId": "GetFileContentByPath_V2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" - }, - "parameters": { - "dataset": "AccountNameFromSettings", - "path": "/uploads/uploads/@{triggerBody()?['cvFile']}", - "inferContentType": true + "Try": { + "actions": { + "GetCvFile": { + "runAfter": { + "DummyCompose": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bb3743dd-d6ee-4df7-98fb-a803dc4475db" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azureblob_1", + "operationId": "GetFileContentByPath_V2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + }, + "parameters": { + "dataset": "AccountNameFromSettings", + "path": "/uploads/uploads/@{triggerBody()?['cvFile']}", + "inferContentType": true + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "GetTranscriptFile": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "14d1a5f7-c71b-418c-b446-255db09927ce" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azureblob_1", - "operationId": "GetFileContentByPath_V2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + "GetTranscriptFile": { + "runAfter": { + "DummyCompose": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "14d1a5f7-c71b-418c-b446-255db09927ce" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azureblob_1", + "operationId": "GetFileContentByPath_V2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + }, + "parameters": { + "dataset": "AccountNameFromSettings", + "path": "uploads/uploads/@{triggerBody()?['transcriptFile']}", + "inferContentType": true + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "dataset": "AccountNameFromSettings", - "path": "uploads/uploads/@{triggerBody()?['transcriptFile']}", - "inferContentType": true + "CreateCvFile": { + "runAfter": { + "GetCvFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "eed4a74f-45b2-460b-a92b-de312a86d0c5" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline", + "operationId": "CreateFile", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Applications/@{triggerBody()?['proposalid']}", + "name": "@triggerBody()?['cvFile']", + "body": "@body('GetCvFile')" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } }, - "authentication": "@parameters('$authentication')" - } - }, - "PersistCVAttachment": { - "runAfter": { - "PersistApplication": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "810da8cd-a83d-482f-82ab-399a9bc6076d" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "CreateTranscriptFile": { + "runAfter": { + "GetTranscriptFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4ab39de7-1c7d-4bbd-8986-da3028cd1dd0" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline", + "operationId": "CreateFile", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Applications/@{triggerBody()?['proposalid']}", + "name": "@triggerBody()?['transcriptFile']", + "body": "@body('GetTranscriptFile')" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[applicationattachment]", - "item/createdAt": "@outputs('PersistApplication')?['body/createdAt']", - "item/href": "@{parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')}/ProposalDocuments/@{triggerBody()?['cvFile']}?csf=1&web=1&e=e8kFFE", - "item/id": "@guid()", - "item/name": "CV", - "item/proposalApplicationId": "@outputs('PersistApplication')?['body/id']", - "item/type": "application/pdf", - "item/updatedAt": "@outputs('PersistApplication')?['body/updatedAt']" + "DeleteCvFile": { + "runAfter": { + "CreateSharingLinkCv": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "74ffde33-ac17-45f9-b451-f2c07ea4bf45" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azureblob_1", + "operationId": "DeleteFile_V2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + }, + "parameters": { + "dataset": "AccountNameFromSettings", + "id": "/uploads/uploads/@{triggerBody()?['cvFile']}" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "PersistApplication": { - "runAfter": { - "DeleteCvFile": [ - "Succeeded" - ], - "DeleteTranscriptFile": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "522c8733-2c39-429f-8220-5d9b6df00127" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "DeleteTranscriptFile": { + "runAfter": { + "CreateSharingLinkTranscript": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4db17421-881c-41cc-acdc-0c0610313238" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azureblob_1", + "operationId": "DeleteFile_V2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + }, + "parameters": { + "dataset": "AccountNameFromSettings", + "id": "/uploads/uploads/@{triggerBody()?['transcriptFile']}" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalapplication]", - "item/createdAt": "@utcNow()", - "item/email": "@triggerBody()?['uzhemail']", - "item/fullName": "@triggerBody()?['fullname']", - "item/id": "@guid()", - "item/matriculationNumber": "@triggerBody()?['matriculationnumber']", - "item/motivation": "@triggerBody()?['motivation']", - "item/plannedStartAt": "@triggerBody()?['startingdate']", - "item/proposalId": "@triggerBody()?['proposalid']", - "item/statusKey": "OPEN", - "item/updatedAt": "@utcNow()" + "DummyCompose": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "a5851fcd-2650-45a7-b21a-f62032a98939" + }, + "type": "Compose", + "inputs": "DoNothing" }, - "authentication": "@parameters('$authentication')" - } - }, - "PersistTranscriptAttachment": { - "runAfter": { - "PersistApplication": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "0bd344e8-ef1b-4632-9084-08bb9284b023" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "PersistApplication": { + "runAfter": { + "DeleteCvFile": [ + "Succeeded" + ], + "DeleteTranscriptFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "522c8733-2c39-429f-8220-5d9b6df00127" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "item/createdAt": "@utcNow()", + "item/email": "@triggerBody()?['uzhemail']", + "item/fullName": "@triggerBody()?['fullname']", + "item/id": "@guid()", + "item/matriculationNumber": "@triggerBody()?['matriculationnumber']", + "item/motivation": "@triggerBody()?['motivation']", + "item/plannedStartAt": "@triggerBody()?['startingdate']", + "item/proposalId": "@triggerBody()?['proposalid']", + "item/statusKey": "OPEN", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[applicationattachment]", - "item/createdAt": "@outputs('PersistApplication')?['body/createdAt']", - "item/href": "@{parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')}/ProposalDocuments/@{triggerBody()?['transcriptFile']}?csf=1&web=1&e=e8kFFE", - "item/id": "@guid()", - "item/name": "Transcript", - "item/proposalApplicationId": "@outputs('PersistApplication')?['body/id']", - "item/type": "application/pdf", - "item/updatedAt": "@outputs('PersistApplication')?['body/updatedAt']" + "PersistCVAttachment": { + "runAfter": { + "PersistApplication": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "810da8cd-a83d-482f-82ab-399a9bc6076d" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[applicationattachment]", + "item/createdAt": "@utcNow()", + "item/href": "@outputs('CreateSharingLinkCv')?['body/link/webUrl']", + "item/id": "@guid()", + "item/name": "CV", + "item/proposalApplicationId": "@outputs('PersistApplication')?['body/id']", + "item/type": "application/pdf", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "DeleteCvFile": { - "runAfter": { - "CreateCvFile": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "74ffde33-ac17-45f9-b451-f2c07ea4bf45" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azureblob_1", - "operationId": "DeleteFile_V2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + "PersistTranscriptAttachment": { + "runAfter": { + "PersistApplication": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0bd344e8-ef1b-4632-9084-08bb9284b023" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[applicationattachment]", + "item/createdAt": "@utcNow()", + "item/href": "@outputs('CreateSharingLinkTranscript')?['body/link/webUrl']", + "item/id": "@guid()", + "item/name": "Transcript", + "item/proposalApplicationId": "@outputs('PersistApplication')?['body/id']", + "item/type": "application/pdf", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "dataset": "AccountNameFromSettings", - "id": "/uploads/uploads/@{triggerBody()?['cvFile']}" + "GetSupervisionDetails": { + "runAfter": { + "PersistCVAttachment": [ + "Succeeded" + ], + "PersistTranscriptAttachment": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c2302b30-1c82-4814-8626-4407bb56d96a" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "id": "@triggerBody()?['proposalid']" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "DeleteTranscriptFile": { - "runAfter": { - "CreateTranscriptFile": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "4db17421-881c-41cc-acdc-0c0610313238" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azureblob_1", - "operationId": "DeleteFile_V2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azureblob" + "GetProposalDetails": { + "runAfter": { + "GetSupervisionDetails": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4e03df1b-d764-44ec-a381-aadfe9a57e22" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "id": "@triggerBody()?['proposalid']" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "dataset": "AccountNameFromSettings", - "id": "/uploads/uploads/@{triggerBody()?['transcriptFile']}" + "SendSupervisorNotification": { + "runAfter": { + "GetProposalDetails": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "9e603a4f-32f8-4286-a880-1c55703f8dba" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@outputs('GetSupervisionDetails')?['body/supervisorEmail']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - New Application for Proposal \"@{outputs('GetProposalDetails')?['body/title']}\"", + "emailMessage/Body": "

Fullname: @{triggerBody()?['fullname']}
\nMatriculation Number: @{triggerBody()?['matriculationnumber']}
\nStart Date: @{triggerBody()?['startingdate']}
\nMotivation: @{triggerBody()?['motivation']}
\n
\nTranscript:
\n
@{outputs('CreateSharingLinkTranscript')?['body/link/webUrl']}
\nPersonal CV:
\n
@{outputs('CreateSharingLinkCv')?['body/link/webUrl']}

", + "emailMessage/Cc": "@outputs('GetProposalDetails')?['body/ownedByUserEmail']", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/ReplyTo": "@triggerBody()?['uzhemail']", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "CreateCvFile": { - "runAfter": { - "GetCvFile": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "eed4a74f-45b2-460b-a92b-de312a86d0c5" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_sharepointonline", - "operationId": "CreateFile", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + "SendStudentConfirmation": { + "runAfter": { + "SendSupervisorNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b04c8a2d-0210-48ae-bb35-86d85590fac8" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@triggerBody()?['uzhemail']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Confirmation Mail", + "emailMessage/Body": "

Dear @{triggerBody()?['fullname']},
\n
\nThank you for applying to the following proposal: \"@{outputs('GetProposalDetails')?['body/title']}\".
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator
\n
\n---
\n
\nFullname: @{triggerBody()?['fullname']}
\nMatriculation Number: @{triggerBody()?['matriculationnumber']}
\nStart Date: @{triggerBody()?['startingdate']}
\nMotivation: @{triggerBody()?['motivation']}

", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Applications/@{triggerBody()?['proposalid']}", - "name": "@triggerBody()?['cvFile']", - "body": "@body('GetCvFile')" + "CreateSharingLinkCv": { + "runAfter": { + "CreateCvFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "93899caf-113e-4aeb-af1c-884dd4c38f2d" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline", + "operationId": "CreateSharingLink", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('CreateCvFile')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" + "CreateSharingLinkTranscript": { + "runAfter": { + "CreateTranscriptFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0c89f939-751e-44ef-bd8f-b2de0a916585" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline", + "operationId": "CreateSharingLink", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('CreateTranscriptFile')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "authentication": "@parameters('$authentication')" + } } - } - }, - "CreateTranscriptFile": { + }, "runAfter": { - "GetTranscriptFile": [ + "IsFLowSecretCorrect": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "4ab39de7-1c7d-4bbd-8986-da3028cd1dd0" + "operationMetadataId": "5dc24c86-4241-49a2-adcd-c9bdc6f126d3" }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_sharepointonline", - "operationId": "CreateFile", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + "type": "Scope" + }, + "Catch": { + "actions": { + "FilterForFailedOrTimedOutStatus": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "ca1bedd8-7555-4a99-a290-1c22c2e6e229" + }, + "type": "Query", + "inputs": { + "from": "@result('Try')", + "where": "@or(equals(item()?['Status'], 'Failed'), equals(item()?['Status'], 'TimedOut'))" + } + }, + "CreateHtmlTable": { + "runAfter": { + "FilterForFailedOrTimedOutStatus": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "34b6a96f-64c6-43fd-89a3-fe7d5ef245ff" + }, + "type": "Table", + "inputs": { + "from": "@body('FilterForFailedOrTimedOutStatus')", + "format": "HTML", + "columns": [ + { + "header": "ProposalId", + "value": "@triggerBody()?['proposalid']" + }, + { + "header": "ProposalTitle", + "value": "@triggerBody()?['proposalTitle']" + }, + { + "header": "Email", + "value": "@triggerBody()?['uzhemail']" + }, + { + "header": "ErrorCode", + "value": "@item()?['code']" + } + ] + } }, - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Applications/@{triggerBody()?['proposalid']}", - "name": "@triggerBody()?['transcriptFile']", - "body": "@body('GetTranscriptFile')" + "Terminate": { + "runAfter": { + "SendFailureNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0f41eff7-41db-4eae-8e12-46f64d545e8b" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } }, - "authentication": "@parameters('$authentication')" - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" + "SendFailureNotification": { + "runAfter": { + "CreateHtmlTable": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e7c370de-36de-45b2-ae99-b7d0e7013242" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sendmail-2", + "operationId": "SendEmailV3", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sendmail" + }, + "parameters": { + "request/to": "@{parameters('Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)')};", + "request/subject": "(@{parameters('Environment (uzhbf_thesisplatform_environment_env_var)')}) Failure in UZH BF Thesis Platform - Thesis Proposal Application", + "request/text": "

@{body('CreateHtmlTable')}

" + }, + "authentication": "@parameters('$authentication')" + } } - } - }, - "GetProposalDetails": { - "runAfter": { - "GetSupervisionDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "4e03df1b-d764-44ec-a381-aadfe9a57e22" }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "GetItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "id": "@triggerBody()?['proposalid']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "GetSupervisionDetails": { "runAfter": { - "PersistCVAttachment": [ - "Succeeded" - ], - "PersistTranscriptAttachment": [ - "Succeeded" + "Try": [ + "Failed", + "TimedOut" ] }, "metadata": { - "operationMetadataId": "c2302b30-1c82-4814-8626-4407bb56d96a" + "operationMetadataId": "054f28a3-080c-4f8a-9529-1183121f12f9" }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "GetItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalsupervision]", - "id": "@triggerBody()?['proposalid']" - }, - "authentication": "@parameters('$authentication')" - } + "type": "Scope" }, - "SendSupervisorNotification": { - "runAfter": { - "GetProposalDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "9e603a4f-32f8-4286-a880-1c55703f8dba" + "IsFLowSecretCorrect": { + "actions": {}, + "runAfter": {}, + "else": { + "actions": { + "Terminate_2": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "b0e5bdca-638d-4f99-bf6a-88e22b939ecb" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + } + } }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" - }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@outputs('GetSupervisionDetails')?['body/supervisorEmail']", - "emailMessage/Subject": "DBF Theses - New Application for Proposal \"@{outputs('GetProposalDetails')?['body/title']}\"", - "emailMessage/Body": "

Fullname: @{triggerBody()?['fullname']}
\nMatriculation Number: @{triggerBody()?['matriculationnumber']}
\nStart Date: @{triggerBody()?['startingdate']}
\nMotivation: @{triggerBody()?['motivation']}
\n
\nTranscript: https://uzh.sharepoint.com/sites/UZHBFThesisPlatformDEV/ProposalDocuments/Applications/@{triggerBody()?['proposalid']}/@{triggerBody()?['cvFile']}
\nPersonal CV: https://uzh.sharepoint.com/sites/UZHBFThesisPlatformDEV/ProposalDocuments/Applications/@{triggerBody()?['proposalid']}/@{triggerBody()?['transcriptFile']}
\n
\n

", - "emailMessage/Cc": "@outputs('GetProposalDetails')?['body/ownedByUserEmail']", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/ReplyTo": "@triggerBody()?['uzhemail']", - "emailMessage/Importance": "Normal" - }, - "authentication": "@parameters('$authentication')" - } - }, - "SendStudentConfirmation": { - "runAfter": { - "SendSupervisorNotification": [ - "Succeeded" + "expression": { + "equals": [ + "@triggerOutputs()['headers']['secretKey']", + "@parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')" ] }, "metadata": { - "operationMetadataId": "b04c8a2d-0210-48ae-bb35-86d85590fac8" + "operationMetadataId": "2e8497de-b65d-41bd-bc3e-8d913d2aba3c" }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" - }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@triggerBody()?['uzhemail']", - "emailMessage/Subject": "BF Theses - Confirmation Mail", - "emailMessage/Body": "

Dear @{triggerBody()?['fullname']},
\n
\nThank you for applying to the following proposal: \"@{outputs('GetProposalDetails')?['body/title']}\".
\n
\nBest regards,
\nDBF Thesis Coordinator
\n
\n---
\n
\nFullname: @{triggerBody()?['fullname']}
\nMatriculation Number: @{triggerBody()?['matriculationnumber']}
\nStart Date: @{triggerBody()?['startingdate']}
\nMotivation: @{triggerBody()?['motivation']}

", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/Importance": "Normal" - }, - "authentication": "@parameters('$authentication')" - } + "type": "If" } } }, diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json.data.xml b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json.data.xml new file mode 100644 index 0000000..480028b --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/UZHBFThesisPlatform-ThesisProposalApplication-3050E705-262A-EE11-BDF5-000D3A831DD0.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 0.0.0.1 + 1 + 0 + 1 + none + + + + \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json index ce3d375..11e811d 100644 --- a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json @@ -27,6 +27,15 @@ "api": { "name": "shared_office365" } + }, + "shared_sendmail-2": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_mail_ref" + }, + "api": { + "name": "shared_sendmail" + } } }, "definition": { @@ -68,6 +77,34 @@ "metadata": { "schemaName": "uzhbf_thesisplatform_supervisors_list_name_env_var" } + }, + "Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)": { + "defaultValue": "flow@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_email_failure_env_var" + } + }, + "Environment (uzhbf_thesisplatform_environment_env_var)": { + "defaultValue": "DEV", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_environment_env_var" + } + }, + "Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)": { + "defaultValue": "abcd", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_flow_secret_env_var" + } + }, + "Department (uzhbf_thesisplatform_department_env_var)": { + "defaultValue": "DBF", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_department_env_var" + } } }, "triggers": { @@ -120,672 +157,620 @@ "type": "object" }, "triggerAuthenticationType": "All" - } + }, + "conditions": [] } }, "actions": { - "GetMatchingProposal": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "979db1ef-80b7-44c7-9a52-47de305a3e9f" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "GetItems", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "Try": { + "actions": { + "DummyCompose": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "17a1a8f0-2e50-4873-85ba-308b2695fa8a" + }, + "type": "Compose", + "inputs": "DoNothing" }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "$filter": "id eq '@{triggerBody()?['proposalId']}'", - "$top": 1 + "GetMatchingProposal": { + "runAfter": { + "DummyCompose": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "979db1ef-80b7-44c7-9a52-47de305a3e9f" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "$filter": "id eq '@{triggerBody()?['proposalId']}'", + "$top": 1 + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "ProposalDetails": { - "runAfter": { - "GetMatchingProposal": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "07c8716c-ce34-4692-a313-e524ee356789" - }, - "type": "Compose", - "inputs": "@first(body('GetMatchingProposal')['value'])" - }, - "GetProposalApplication": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "baa5f673-ab9b-4eda-abc3-3da844e3921c" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "GetItems", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "MatchingSupervisor": { + "runAfter": { + "DummyCompose": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bd22650b-e96a-448f-9483-fb98a6b2a917" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')", + "$filter": "Title eq '@{triggerBody()?['supervisoremail']}'", + "$top": 1 + }, + "authentication": "@parameters('$authentication')" + } + }, + "GetProposalApplication": { + "runAfter": { + "DummyCompose": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "baa5f673-ab9b-4eda-abc3-3da844e3921c" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "$filter": "proposalId eq '@{triggerBody()?['proposalid']}'" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalapplication]", - "$filter": "id eq '@{triggerBody()?['proposalid']}'", - "$top": 1 + "ProposalDetails": { + "runAfter": { + "GetMatchingProposal": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "07c8716c-ce34-4692-a313-e524ee356789" + }, + "type": "Compose", + "inputs": "@first(body('GetMatchingProposal')['value'])" }, - "authentication": "@parameters('$authentication')" - } - }, - "ApplicationDetails": { - "runAfter": { - "GetProposalApplication": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "725427ad-a396-4f7f-94fe-18202dcffc15" - }, - "type": "Compose", - "inputs": "@first(body('GetProposalApplication')['value'])" - }, - "MatchingSupervisor": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "bd22650b-e96a-448f-9483-fb98a6b2a917" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_sharepointonline", - "operationId": "GetItems", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + "SupervisorDetails": { + "runAfter": { + "MatchingSupervisor": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4fed7a55-4515-4bf4-95fa-a1e295c50e03" + }, + "type": "Compose", + "inputs": "@first(body('MatchingSupervisor')['value'])" }, - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')", - "$filter": "Title eq '@{triggerBody()?['supervisoremail']}'", - "$top": 1 + "ApplicationDetails": { + "runAfter": { + "GetProposalApplication": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "725427ad-a396-4f7f-94fe-18202dcffc15" + }, + "type": "Compose", + "inputs": "@first(body('GetProposalApplication')['value'])" }, - "authentication": "@parameters('$authentication')" - } - }, - "SupervisorDetails": { - "runAfter": { - "MatchingSupervisor": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "4fed7a55-4515-4bf4-95fa-a1e295c50e03" - }, - "type": "Compose", - "inputs": "@first(body('MatchingSupervisor')['value'])" - }, - "Switch": { - "runAfter": { - "IsAutoInvokedAction": [ - "Succeeded" - ] - }, - "cases": { - "Accept": { - "case": "ACCEPT", + "IsAutoInvokedAction": { "actions": { - "UpdateProposalStatusAccept": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "7535e2a2-c386-4e8f-abaf-6af7cf4c0159" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PatchItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "id": "@triggerBody()?['proposalid']", - "item/createdAt": "@outputs('ProposalDetails')['createdAt']", - "item/description": "@outputs('ProposalDetails')['description']", - "item/language": "@outputs('ProposalDetails')['language']", - "item/statusKey": "MATCHED", - "item/studyLevel": "@outputs('ProposalDetails')['studyLevel']", - "item/title": "@outputs('ProposalDetails')['title']", - "item/topicAreaSlug": "@outputs('ProposalDetails')['topicAreaSlug']", - "item/typeKey": "@outputs('ProposalDetails')['typeKey']", - "item/updatedAt": "@outputs('ProposalDetails')['updatedAt']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "UpdateStudentApplicationAccept": { - "runAfter": { - "IsStatusKeyOpen": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "7a443136-70e4-4642-a1eb-b0beee17972b" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PatchItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalapplication]", - "id": "@triggerBody()?['proposalId']", - "item/createdAt": "@outputs('ApplicationDetails')['createdAt']", - "item/email": "@outputs('ApplicationDetails')['email']", - "item/fullName": "@outputs('ApplicationDetails')['fullName']", - "item/matriculationNumber": "@outputs('ApplicationDetails')['matriculationNumber']", - "item/motivation": "@outputs('ApplicationDetails')['motivation']", - "item/plannedStartAt": "@outputs('ApplicationDetails')['plannedStartAt']", - "item/proposalId": "@outputs('ApplicationDetails')['proposalId']", - "item/statusKey": "ACCEPTED", - "item/updatedAt": "@outputs('ApplicationDetails')['updatedAt']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "AcceptanceNotification": { - "runAfter": { - "UpdateStudentApplicationAccept": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "df532c74-17e4-4547-ab22-d8685e1eb082" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" - }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@{outputs('ApplicationDetails')['email']};@{triggerBody()?['supervisorEmail']}", - "emailMessage/Subject": "DBF Theses - Your Proposal has been accepted", - "emailMessage/Body": "

Dear @{outputs('ApplicationDetails')['fullName']},
\n
\nYour proposal on \"@{outputs('ProposalDetails')['title']}\" has been accepted by a supervisor. Please get in touch with your supervisor \"@{outputs('SupervisorDetails')['field_1']}\" to get started with the thesis process (just reply to this email).
\n
\nBest regards,
\nDBF Thesis Coordinator
\n
\n---
\n
\nMessage of your supervisor: @{triggerBody()?['comment']}

", - "emailMessage/Cc": "@outputs('CreateAcceptSupervision')?['body/supervisorEmail']", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/ReplyTo": "@triggerBody()?['supervisorEmail']", - "emailMessage/Importance": "Normal" + "IsAlreadyAccepted": { + "actions": { + "Response": { + "runAfter": { + "ComposeAlreadyAcceptedResponse": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "587d7896-600a-4582-88f4-f7adb0b524f3" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeAlreadyAcceptedResponse')" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "ComposeAcceptResponse": { - "runAfter": { - "AcceptanceNotification": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "2cdc3e44-0062-4866-a6f9-eca6b8231044" - }, - "type": "Compose", - "inputs": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "body": [ - { - "size": "Medium", - "text": "Thesis Proposal Accepted", - "type": "TextBlock", - "weight": "Bolder" + "Terminate_2": { + "runAfter": { + "Response": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "30e0b4b9-13f6-451b-8582-402df8cbf50a" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Succeeded" } - ], - "type": "AdaptiveCard", - "version": "1.0" - } - }, - "AcceptResponse": { - "runAfter": { - "ComposeAcceptResponse": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "b28276f8-db87-4742-afc2-bf8251d4cb6b" - }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200, - "headers": { - "CARD-UPDATE-IN-BODY": "true" }, - "body": "@outputs('ComposeAcceptResponse')" - } - }, - "IsStatusKeyOpen": { - "actions": { - "CreateAcceptSupervision": { + "GetAcceptedSupervisor": { "runAfter": {}, "metadata": { - "operationMetadataId": "b2bca9b1-69a4-4e1d-8b9f-46ffa7645a5b" + "operationMetadataId": "19d31a2a-f034-4f8a-a629-02c16a319f8e" }, "type": "OpenApiConnection", "inputs": { "host": { "connectionName": "shared_azuremysql", - "operationId": "PostItem", + "operationId": "GetItems", "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" }, "parameters": { "server": "default", "database": "default", "table": "[main].[userproposalsupervision]", - "item/id": "@triggerBody()?['proposalId']", - "item/proposalId": "@triggerBody()?['proposalId']", - "item/supervisorEmail": "@triggerBody()?['supervisorEmail']" + "$filter": "id eq '@{triggerBody()?['proposalid']}'", + "$top": 1 }, "authentication": "@parameters('$authentication')" } - } - }, - "runAfter": { - "UpdateProposalStatusAccept": [ - "Succeeded" - ] - }, - "expression": { - "equals": [ - "@outputs('ApplicationDetails')['statusKey']", - "OPEN" - ] - }, - "metadata": { - "operationMetadataId": "d2bc87da-0e52-4a9e-9bb2-54e6fedabe6b" - }, - "type": "If" - } - } - }, - "Accept_Tentative": { - "case": "ACCEPT_TENTATIVE", - "actions": { - "UpdateProposalStatusAcceptTentative": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "4331e6c0-ad64-47f4-b1a2-702a4c6ac25f" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PatchItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "id": "@triggerBody()?['proposalId']", - "item/createdAt": "@outputs('ProposalDetails')['createdAt']", - "item/description": "@outputs('ProposalDetails')['description']", - "item/language": "@outputs('ProposalDetails')['language']", - "item/statusKey": "MATCHED_TENTATIVE", - "item/studyLevel": "@outputs('ProposalDetails')['studyLevel']", - "item/title": "@outputs('ProposalDetails')['title']", - "item/topicAreaSlug": "@outputs('ProposalDetails')['topicAreaSlug']", - "item/typeKey": "@outputs('ProposalDetails')['typeKey']", - "item/updatedAt": "@outputs('ProposalDetails')['updatedAt']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "CreateTentativeAcceptSupervision": { - "runAfter": { - "UpdateProposalStatusAcceptTentative": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "add79b87-4eeb-4e50-b802-6aadde3db15c" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalsupervision]", - "item/id": "@triggerBody()?['proposalId']", - "item/proposalId": "@triggerBody()?['proposalId']", - "item/supervisorEmail": "@triggerBody()?['supervisorEmail']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "UpdateStudentApplicationAcceptTentative": { - "runAfter": { - "CreateTentativeAcceptSupervision": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "72b788ae-9d04-4c4c-886e-2f8f5be3bc33" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PatchItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalapplication]", - "id": "@triggerBody()?['proposalId']", - "item/createdAt": "@outputs('ApplicationDetails')['createdAt']", - "item/email": "@outputs('ApplicationDetails')['email']", - "item/fullName": "@outputs('ApplicationDetails')['fullName']", - "item/matriculationNumber": "@outputs('ApplicationDetails')['matriculationNumber']", - "item/motivation": "@outputs('ApplicationDetails')['motivation']", - "item/plannedStartAt": "@outputs('ApplicationDetails')['plannedStartAt']", - "item/proposalId": "@outputs('ApplicationDetails')['proposalId']", - "item/statusKey": "ACCEPTED_TENTATIVE", - "item/updatedAt": "@outputs('ApplicationDetails')['updatedAt']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "TentativeAcceptanceNotification": { - "runAfter": { - "UpdateStudentApplicationAcceptTentative": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "fb0316ef-5a1a-4a75-b425-a805eba40653" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@{outputs('ApplicationDetails')['email']};@{triggerBody()?['supervisorEmail']}", - "emailMessage/Subject": "DBF Theses - Your Proposal has attracted interest", - "emailMessage/Body": "

Dear @{outputs('ApplicationDetails')['fullName']},
\n
\nYour proposal on \"@{outputs('ProposalDetails')['title']}\" has attracted the interest of a supervisor on the condition that the proposal is improved in certain areas. Please review the supervisor feedback, adjust your proposal as needed, and get in touch with your potential supervisor \"@{outputs('SupervisorDetails')['field_1']}\" (just reply to this email).
\n
\nBest regards,
\nDBF Thesis Coordinator
\n
\n---
\n
\nFeedback of your potential supervisor: @{triggerBody()?['comment']}

", - "emailMessage/Cc": "@triggerBody()?['supervisorEmail']", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/ReplyTo": "@triggerBody()?['supervisorEmail']", - "emailMessage/Importance": "Normal" + "ComposeAlreadyAcceptedResponse": { + "runAfter": { + "AcceptedSupervisorDetails": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e2871993-5858-486e-b8e6-9a3e8a89ee6a" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "Thesis Proposal was already accepted by @{outputs('AcceptedSupervisorDetails')['supervisorEmail']} (@{outputs('ApplicationDetails')['statusKey']})", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } }, - "authentication": "@parameters('$authentication')" - } - }, - "ComposeAcceptTentativeResponse": { - "runAfter": { - "TentativeAcceptanceNotification": [ - "Succeeded" - ] + "AcceptedSupervisorDetails": { + "runAfter": { + "GetAcceptedSupervisor": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "df3def8f-9776-4c1e-89cd-f538ca85a6ba" + }, + "type": "Compose", + "inputs": "@first(body('GetAcceptedSupervisor')['value'])" + } }, - "metadata": { - "operationMetadataId": "3b8a8234-2ea8-4734-bc8c-7d2a2086e40b" + "runAfter": {}, + "else": { + "actions": { + "Terminate": { + "runAfter": { + "Scope": [ + "Failed", + "TimedOut" + ] + }, + "metadata": { + "operationMetadataId": "5fb1e9d7-d829-4b1d-8daa-895dccb71412" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Succeeded" + } + }, + "Scope": { + "actions": { + "GetProvidedFeedbackEntries": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "85c00d53-3213-40c6-b64c-825e1df04411" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalfeedback]", + "$filter": "proposalId eq '@{triggerBody()?['proposalId']}' and userEmail eq '@{triggerBody()?['supervisorEmail']}'" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Condition": { + "actions": { + "ComposeAlreadyProvidedFeedback": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "e2871993-5858-486e-b8e6-9a3e8a89ee6a" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "You have already rejected/declined this proposal!", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } + }, + "ResponseFeedback": { + "runAfter": { + "ComposeAlreadyProvidedFeedback": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "587d7896-600a-4582-88f4-f7adb0b524f3" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeAlreadyProvidedFeedback')" + } + }, + "Terminate_4": { + "runAfter": { + "ResponseFeedback": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5fb1e9d7-d829-4b1d-8daa-895dccb71412" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Succeeded" + } + } + }, + "runAfter": { + "Compose": [ + "Succeeded" + ] + }, + "else": { + "actions": { + "Terminate_5": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "5fb1e9d7-d829-4b1d-8daa-895dccb71412" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Succeeded" + } + } + } + }, + "expression": { + "equals": [ + "@outputs('Compose')['userEmail']", + "@triggerBody()?['supervisorEmail']" + ] + }, + "metadata": { + "operationMetadataId": "f65d1d1d-20d9-47cd-8291-b6c8f00e9f7f" + }, + "type": "If" + }, + "Compose": { + "runAfter": { + "GetProvidedFeedbackEntries": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "24d52f92-3c1f-4177-b401-12d10649b0a3" + }, + "type": "Compose", + "inputs": "@first(outputs('GetProvidedFeedbackEntries')?['body/value'])" + } + }, + "runAfter": {}, + "metadata": { + "operationMetadataId": "001e4862-207d-4d76-8244-fd9d0b2d5afa" + }, + "type": "Scope" + } + } }, - "type": "Compose", - "inputs": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "body": [ + "expression": { + "or": [ + { + "equals": [ + "@outputs('ApplicationDetails')['statusKey']", + "ACCEPTED" + ] + }, { - "size": "Medium", - "text": "Thesis Proposal Tentatively Accepted", - "type": "TextBlock", - "weight": "Bolder" + "equals": [ + "@outputs('ApplicationDetails')['statusKey']", + "ACCEPTED_TENTATIVE" + ] } - ], - "type": "AdaptiveCard", - "version": "1.0" - } - }, - "AcceptTentativeResponse": { - "runAfter": { - "ComposeAcceptTentativeResponse": [ - "Succeeded" ] }, "metadata": { - "operationMetadataId": "4ed555d0-c4a0-49b2-90f4-cd829feeb041" + "operationMetadataId": "9bd9abc8-9ac9-4134-a2e3-72100f394b43" }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200, - "headers": { - "CARD-UPDATE-IN-BODY": "true" - }, - "body": "@outputs('ComposeAcceptTentativeResponse')" - } + "type": "If" } - } + }, + "runAfter": { + "ApplicationDetails": [ + "Succeeded" + ], + "ProposalDetails": [ + "Succeeded" + ], + "SupervisorDetails": [ + "Succeeded" + ] + }, + "expression": { + "equals": [ + "@triggerBody()?['actionType']", + "REFETCH" + ] + }, + "metadata": { + "operationMetadataId": "7d582be1-075d-4223-8d22-7c7e4fb1dd8e" + }, + "type": "If" }, - "Decline": { - "case": "DECLINE", - "actions": { - "PersistDeclineFeedback": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "5bc2b7d0-6c92-43d5-bc81-0473ac0f025e" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" - }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalfeedback]", - "item/comment": "@triggerBody()?['comment']", - "item/id": "@guid()", - "item/proposalId": "@triggerBody()?['proposalId']", - "item/reason": "@triggerBody()?['reason']", - "item/typeKey": "DECLINED_@{triggerBody()?['reason']}", - "item/userEmail": "@triggerBody()?['supervisorEmail']" - }, - "authentication": "@parameters('$authentication')" - } - }, - "DeclineNotification": { - "runAfter": { - "PersistDeclineFeedback": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "c71259f9-094e-4c1d-86ec-684e6f6380cd" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" - }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/Subject": "DBF Theses - Proposal declined (@{outputs('ProposalDetails')['title']})", - "emailMessage/Body": "

The proposal \"@{outputs('ProposalDetails')['title']}\" has been declined by \"@{outputs('SupervisorDetails')['field_1']}\".
\n
\nReason: @{triggerBody()?['reason']}
\nComment: @{triggerBody()?['comment']}

", - "emailMessage/Importance": "Normal" - }, - "authentication": "@parameters('$authentication')" - } - }, - "ComposeDeclineResponse": { - "runAfter": { - "DeclineNotification": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "381fa989-f265-46ee-bbd4-b5fe2c8bca59" - }, - "type": "Compose", - "inputs": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "body": [ - { - "size": "Medium", - "text": "Thesis Proposal Declined", - "type": "TextBlock", - "weight": "Bolder" - } - ], - "type": "AdaptiveCard", - "version": "1.0" - } - }, - "DeclineResponse": { - "runAfter": { - "ComposeDeclineResponse": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "35a799df-bc89-4032-829d-6f943524cff6" - }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200, - "headers": { - "CARD-UPDATE-IN-BODY": "true" - }, - "body": "@outputs('ComposeDeclineResponse')" - } - } - } - }, - "Reject": { - "case": "REJECT", - "actions": { - "RejectNotification": { - "runAfter": { - "PersistRejectFeedback": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "647c1798-dde8-4ed4-a921-6572d4b5cd77" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_office365_1", - "operationId": "SharedMailboxSendEmailV2", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" - }, - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/Subject": "DBF Theses - Proposal rejected (@{outputs('ProposalDetails')['title']})", - "emailMessage/Body": "

The proposal \"@{outputs('ProposalDetails')['title']}\" has been rejected by \"@{outputs('SupervisorDetails')['field_1']}\".
\n
\nReason: @{triggerBody()?['reason']}
\nComment: @{triggerBody()?['comment']}

", - "emailMessage/Importance": "Normal" - }, - "authentication": "@parameters('$authentication')" - } - }, - "ComposeRejectResponse": { - "runAfter": { - "RejectNotification": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "bc91fc1b-3a49-494d-adab-6585a07d0f0f" - }, - "type": "Compose", - "inputs": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "body": [ - { - "size": "Medium", - "text": "Thesis Proposal Rejected", - "type": "TextBlock", - "weight": "Bolder" - } - ], - "type": "AdaptiveCard", - "version": "1.0" - } - }, - "RejectResponse": { - "runAfter": { - "ComposeRejectResponse": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "841ddf7a-a2fb-4073-868b-e31da5fe675e" - }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200, - "headers": { - "CARD-UPDATE-IN-BODY": "true" - }, - "body": "@outputs('ComposeRejectResponse')" - } - }, - "IsStatusKeyAcceptedTentative": { + "Switch": { + "runAfter": { + "IsAutoInvokedAction": [ + "Succeeded" + ] + }, + "cases": { + "Accept": { + "case": "ACCEPT", "actions": { - "DeleteSupervision": { + "UpdateProposalStatusAccept": { "runAfter": {}, "metadata": { - "operationMetadataId": "cdf7798e-3049-40c7-8cde-4ef065861c2e" + "operationMetadataId": "7535e2a2-c386-4e8f-abaf-6af7cf4c0159" }, "type": "OpenApiConnection", "inputs": { "host": { "connectionName": "shared_azuremysql", - "operationId": "DeleteItem", + "operationId": "PatchItem", "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" }, "parameters": { "server": "default", "database": "default", - "table": "[main].[userproposalsupervision]", - "id": "@triggerBody()?['proposalId']" + "table": "[main].[proposal]", + "id": "@triggerBody()?['proposalid']", + "item/createdAt": "@outputs('ProposalDetails')['createdAt']", + "item/description": "@outputs('ProposalDetails')['description']", + "item/language": "@outputs('ProposalDetails')['language']", + "item/statusKey": "MATCHED", + "item/studyLevel": "@outputs('ProposalDetails')['studyLevel']", + "item/title": "@outputs('ProposalDetails')['title']", + "item/topicAreaSlug": "@outputs('ProposalDetails')['topicAreaSlug']", + "item/typeKey": "@outputs('ProposalDetails')['typeKey']", + "item/updatedAt": "@utcNow()" }, "authentication": "@parameters('$authentication')" } }, - "UpdateProposalStatusKeyOpen": { + "UpdateStudentApplicationAccept": { "runAfter": { - "UpdateProposalApplicationStatusKeyOpen": [ + "IsStatusKeyOpen": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "aa93c012-cb6d-42c6-bd72-ef1574acb2f6" + "operationMetadataId": "7a443136-70e4-4642-a1eb-b0beee17972b" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "id": "@triggerBody()?['proposalId']", + "item/createdAt": "@outputs('ApplicationDetails')['createdAt']", + "item/email": "@outputs('ApplicationDetails')['email']", + "item/fullName": "@outputs('ApplicationDetails')['fullName']", + "item/matriculationNumber": "@outputs('ApplicationDetails')['matriculationNumber']", + "item/motivation": "@outputs('ApplicationDetails')['motivation']", + "item/plannedStartAt": "@outputs('ApplicationDetails')['plannedStartAt']", + "item/proposalId": "@outputs('ApplicationDetails')['proposalId']", + "item/statusKey": "ACCEPTED", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } + }, + "AcceptanceNotification": { + "runAfter": { + "UpdateStudentApplicationAccept": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "df532c74-17e4-4547-ab22-d8685e1eb082" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@{outputs('ApplicationDetails')['email']};@{triggerBody()?['supervisorEmail']}", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Your Proposal has been accepted", + "emailMessage/Body": "

Dear @{outputs('ApplicationDetails')['fullName']},
\n
\nYour proposal on \"@{outputs('ProposalDetails')['title']}\" has been accepted by a supervisor. Please get in touch with your supervisor \"@{triggerBody()?['supervisorEmail']}\" to get started with the thesis process (just reply to this email).
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator
\n
\n---
\n
\nMessage of your supervisor: @{triggerBody()?['comment']}

", + "emailMessage/Cc": "@outputs('CreateAcceptSupervision')?['body/supervisorEmail']", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/ReplyTo": "@triggerBody()?['supervisorEmail']", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "ComposeAcceptResponse": { + "runAfter": { + "AcceptanceNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "2cdc3e44-0062-4866-a6f9-eca6b8231044" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "Thesis Proposal Accepted", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } + }, + "AcceptResponse": { + "runAfter": { + "ComposeAcceptResponse": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b28276f8-db87-4742-afc2-bf8251d4cb6b" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeAcceptResponse')" + } + }, + "IsStatusKeyOpen": { + "actions": { + "CreateAcceptSupervision": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "b2bca9b1-69a4-4e1d-8b9f-46ffa7645a5b" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "item/createdAt": "@utcNow()", + "item/id": "@triggerBody()?['proposalId']", + "item/proposalId": "@triggerBody()?['proposalId']", + "item/updatedAt": "@utcNow()", + "item/supervisorEmail": "@triggerBody()?['supervisorEmail']" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": { + "UpdateProposalStatusAccept": [ + "Succeeded" + ] + }, + "expression": { + "equals": [ + "@outputs('ApplicationDetails')['statusKey']", + "OPEN" + ] + }, + "metadata": { + "operationMetadataId": "d2bc87da-0e52-4a9e-9bb2-54e6fedabe6b" + }, + "type": "If" + } + } + }, + "Accept_Tentative": { + "case": "ACCEPT_TENTATIVE", + "actions": { + "UpdateProposalStatusAcceptTentative": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "4331e6c0-ad64-47f4-b1a2-702a4c6ac25f" }, "type": "OpenApiConnection", "inputs": { @@ -802,24 +787,53 @@ "item/createdAt": "@outputs('ProposalDetails')['createdAt']", "item/description": "@outputs('ProposalDetails')['description']", "item/language": "@outputs('ProposalDetails')['language']", - "item/statusKey": "OPEN", + "item/statusKey": "MATCHED_TENTATIVE", "item/studyLevel": "@outputs('ProposalDetails')['studyLevel']", "item/title": "@outputs('ProposalDetails')['title']", "item/topicAreaSlug": "@outputs('ProposalDetails')['topicAreaSlug']", "item/typeKey": "@outputs('ProposalDetails')['typeKey']", - "item/updatedAt": "@outputs('ProposalDetails')['updatedAt']" + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } + }, + "CreateTentativeAcceptSupervision": { + "runAfter": { + "UpdateProposalStatusAcceptTentative": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "add79b87-4eeb-4e50-b802-6aadde3db15c" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "item/createdAt": "@utcNow()", + "item/id": "@triggerBody()?['proposalId']", + "item/proposalId": "@triggerBody()?['proposalId']", + "item/updatedAt": "@utcNow()", + "item/supervisorEmail": "@triggerBody()?['supervisorEmail']" }, "authentication": "@parameters('$authentication')" } }, - "UpdateProposalApplicationStatusKeyOpen": { + "UpdateStudentApplicationAcceptTentative": { "runAfter": { - "DeleteSupervision": [ + "CreateTentativeAcceptSupervision": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "311d5cd3-d344-47a3-99b8-9b0664a34f4e" + "operationMetadataId": "72b788ae-9d04-4c4c-886e-2f8f5be3bc33" }, "type": "OpenApiConnection", "inputs": { @@ -839,232 +853,553 @@ "item/matriculationNumber": "@outputs('ApplicationDetails')['matriculationNumber']", "item/motivation": "@outputs('ApplicationDetails')['motivation']", "item/plannedStartAt": "@outputs('ApplicationDetails')['plannedStartAt']", - "item/proposalId": "@triggerBody()?['proposalId']", - "item/statusKey": "OPEN", - "item/updatedAt": "@outputs('ApplicationDetails')['updatedAt']" + "item/proposalId": "@outputs('ApplicationDetails')['proposalId']", + "item/statusKey": "ACCEPTED_TENTATIVE", + "item/updatedAt": "@utcNow()" }, "authentication": "@parameters('$authentication')" } - } - }, - "runAfter": {}, - "expression": { - "equals": [ - "@outputs('ApplicationDetails')['statusKey']", - "ACCEPTED_TENTATIVE" - ] - }, - "metadata": { - "operationMetadataId": "ffc51d56-fc50-474a-8db9-d35eedebc5fc" - }, - "type": "If" - }, - "PersistRejectFeedback": { - "runAfter": { - "IsStatusKeyAcceptedTentative": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "f305428c-9d61-40a0-8cb6-b53c26852d0c" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "PostItem", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalfeedback]", - "item/comment": "@triggerBody()?['comment']", - "item/id": "@guid()", - "item/proposalId": "@triggerBody()?['proposalId']", - "item/reason": "@triggerBody()?['reason']", - "item/typeKey": "REJECTED_@{triggerBody()?['reason']}", - "item/userEmail": "@triggerBody()?['supervisorEmail']" + "TentativeAcceptanceNotification": { + "runAfter": { + "UpdateStudentApplicationAcceptTentative": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "fb0316ef-5a1a-4a75-b425-a805eba40653" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@{outputs('ApplicationDetails')['email']};@{triggerBody()?['supervisorEmail']}", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Your Proposal has attracted interest", + "emailMessage/Body": "

Dear @{outputs('ApplicationDetails')['fullName']},
\n
\nYour proposal on \"@{outputs('ProposalDetails')['title']}\" has attracted the interest of a supervisor on the condition that the proposal is improved in certain areas. Please review the supervisor feedback, adjust your proposal as needed, and get in touch with your potential supervisor \"@{triggerBody()?['supervisorEmail']}\" (just reply to this email).
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator
\n
\n---
\n
\nFeedback of your potential supervisor: @{triggerBody()?['comment']}

", + "emailMessage/Cc": "@triggerBody()?['supervisorEmail']", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/ReplyTo": "@triggerBody()?['supervisorEmail']", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } }, - "authentication": "@parameters('$authentication')" - } - } - } - } - }, - "default": { - "actions": { - "Response_4": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "00598947-556d-4afd-8e0c-11c0310f81cc" - }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200 - } - } - } - }, - "expression": "@triggerBody()?['actionType']", - "metadata": { - "operationMetadataId": "5c463cf4-8eb0-443f-99c0-d7807cd879b1" - }, - "type": "Switch" - }, - "IsAutoInvokedAction": { - "actions": { - "IsAlreadyAccepted": { - "actions": { - "Response": { - "runAfter": { - "ComposeAlreadyAcceptedResponse": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "587d7896-600a-4582-88f4-f7adb0b524f3" - }, - "type": "Response", - "kind": "Http", - "inputs": { - "statusCode": 200, - "headers": { - "CARD-UPDATE-IN-BODY": "true" + "ComposeAcceptTentativeResponse": { + "runAfter": { + "TentativeAcceptanceNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "3b8a8234-2ea8-4734-bc8c-7d2a2086e40b" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "Thesis Proposal Tentatively Accepted", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } }, - "body": "@outputs('ComposeAlreadyAcceptedResponse')" - } - }, - "Terminate_2": { - "runAfter": { - "Response": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "30e0b4b9-13f6-451b-8582-402df8cbf50a" - }, - "type": "Terminate", - "inputs": { - "runStatus": "Succeeded" + "AcceptTentativeResponse": { + "runAfter": { + "ComposeAcceptTentativeResponse": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4ed555d0-c4a0-49b2-90f4-cd829feeb041" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeAcceptTentativeResponse')" + } + } } }, - "GetAcceptedSupervisor": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "19d31a2a-f034-4f8a-a629-02c16a319f8e" - }, - "type": "OpenApiConnection", - "inputs": { - "host": { - "connectionName": "shared_azuremysql", - "operationId": "GetItems", - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + "Decline": { + "case": "DECLINE", + "actions": { + "PersistDeclineFeedback": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "5bc2b7d0-6c92-43d5-bc81-0473ac0f025e" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalfeedback]", + "item/comment": "@triggerBody()?['comment']", + "item/createdAt": "@utcNow()", + "item/id": "@guid()", + "item/proposalId": "@triggerBody()?['proposalId']", + "item/reason": "@triggerBody()?['reason']", + "item/typeKey": "DECLINED_@{triggerBody()?['reason']}", + "item/updatedAt": "@utcNow()", + "item/userEmail": "@triggerBody()?['supervisorEmail']" + }, + "authentication": "@parameters('$authentication')" + } }, - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalsupervision]", - "$filter": "id eq '@{triggerBody()?['proposalid']}'", - "$top": 1 + "DeclineNotification": { + "runAfter": { + "PersistDeclineFeedback": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c71259f9-094e-4c1d-86ec-684e6f6380cd" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Proposal declined (@{outputs('ProposalDetails')['title']})", + "emailMessage/Body": "

The proposal \"@{outputs('ProposalDetails')['title']}\" has been declined by \"@{triggerBody()?['supervisorEmail']}\".
\n
\nReason: @{triggerBody()?['reason']}
\nComment: @{triggerBody()?['comment']}

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "ComposeDeclineResponse": { + "runAfter": { + "DeclineNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "381fa989-f265-46ee-bbd4-b5fe2c8bca59" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "Thesis Proposal Declined", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } }, - "authentication": "@parameters('$authentication')" + "DeclineResponse": { + "runAfter": { + "ComposeDeclineResponse": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "35a799df-bc89-4032-829d-6f943524cff6" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeDeclineResponse')" + } + } } }, - "ComposeAlreadyAcceptedResponse": { - "runAfter": { - "AcceptedSupervisorDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "e2871993-5858-486e-b8e6-9a3e8a89ee6a" - }, - "type": "Compose", - "inputs": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "body": [ - { - "size": "Medium", - "text": "Thesis Proposal was already accepted by @{outputs('AcceptedSupervisorDetails')['supervisorEmail']} (@{outputs('ApplicationDetails')['statusKey']})", - "type": "TextBlock", - "weight": "Bolder" + "Reject": { + "case": "REJECT", + "actions": { + "RejectNotification": { + "runAfter": { + "PersistRejectFeedback": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "647c1798-dde8-4ed4-a921-6572d4b5cd77" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365_1", + "operationId": "SharedMailboxSendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Proposal rejected (@{outputs('ProposalDetails')['title']})", + "emailMessage/Body": "

The proposal \"@{outputs('ProposalDetails')['title']}\" has been rejected by \"@{triggerBody()?['supervisorEmail']}\".
\n
\nReason: @{triggerBody()?['reason']}
\nComment: @{triggerBody()?['comment']}

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "ComposeRejectResponse": { + "runAfter": { + "RejectNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bc91fc1b-3a49-494d-adab-6585a07d0f0f" + }, + "type": "Compose", + "inputs": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "body": [ + { + "size": "Medium", + "text": "Thesis Proposal Rejected", + "type": "TextBlock", + "weight": "Bolder" + } + ], + "type": "AdaptiveCard", + "version": "1.0" + } + }, + "RejectResponse": { + "runAfter": { + "ComposeRejectResponse": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "841ddf7a-a2fb-4073-868b-e31da5fe675e" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "headers": { + "CARD-UPDATE-IN-BODY": "true" + }, + "body": "@outputs('ComposeRejectResponse')" } - ], - "type": "AdaptiveCard", - "version": "1.0" + }, + "IsStatusKeyAcceptedTentative": { + "actions": { + "DeleteSupervision": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "cdf7798e-3049-40c7-8cde-4ef065861c2e" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "DeleteItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "id": "@triggerBody()?['proposalId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "UpdateProposalStatusKeyOpen": { + "runAfter": { + "UpdateProposalApplicationStatusKeyOpen": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "aa93c012-cb6d-42c6-bd72-ef1574acb2f6" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "id": "@triggerBody()?['proposalId']", + "item/createdAt": "@outputs('ProposalDetails')['createdAt']", + "item/description": "@outputs('ProposalDetails')['description']", + "item/language": "@outputs('ProposalDetails')['language']", + "item/statusKey": "OPEN", + "item/studyLevel": "@outputs('ProposalDetails')['studyLevel']", + "item/title": "@outputs('ProposalDetails')['title']", + "item/topicAreaSlug": "@outputs('ProposalDetails')['topicAreaSlug']", + "item/typeKey": "@outputs('ProposalDetails')['typeKey']", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } + }, + "UpdateProposalApplicationStatusKeyOpen": { + "runAfter": { + "DeleteSupervision": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "311d5cd3-d344-47a3-99b8-9b0664a34f4e" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PatchItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "id": "@triggerBody()?['proposalId']", + "item/createdAt": "@outputs('ApplicationDetails')['createdAt']", + "item/email": "@outputs('ApplicationDetails')['email']", + "item/fullName": "@outputs('ApplicationDetails')['fullName']", + "item/matriculationNumber": "@outputs('ApplicationDetails')['matriculationNumber']", + "item/motivation": "@outputs('ApplicationDetails')['motivation']", + "item/plannedStartAt": "@outputs('ApplicationDetails')['plannedStartAt']", + "item/proposalId": "@triggerBody()?['proposalId']", + "item/statusKey": "OPEN", + "item/updatedAt": "@utcNow()" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": {}, + "expression": { + "equals": [ + "@outputs('ApplicationDetails')['statusKey']", + "ACCEPTED_TENTATIVE" + ] + }, + "metadata": { + "operationMetadataId": "ffc51d56-fc50-474a-8db9-d35eedebc5fc" + }, + "type": "If" + }, + "PersistRejectFeedback": { + "runAfter": { + "IsStatusKeyAcceptedTentative": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "f305428c-9d61-40a0-8cb6-b53c26852d0c" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_azuremysql", + "operationId": "PostItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql" + }, + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalfeedback]", + "item/comment": "@triggerBody()?['comment']", + "item/createdAt": "@utcNow()", + "item/id": "@guid()", + "item/proposalId": "@triggerBody()?['proposalId']", + "item/reason": "@triggerBody()?['reason']", + "item/typeKey": "REJECTED_@{triggerBody()?['reason']}", + "item/updatedAt": "@utcNow()", + "item/userEmail": "@triggerBody()?['supervisorEmail']" + }, + "authentication": "@parameters('$authentication')" + } + } } - }, - "AcceptedSupervisorDetails": { - "runAfter": { - "GetAcceptedSupervisor": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "df3def8f-9776-4c1e-89cd-f538ca85a6ba" - }, - "type": "Compose", - "inputs": "@first(body('GetAcceptedSupervisor')['value'])" } }, - "runAfter": {}, - "else": { + "default": { "actions": { - "Terminate": { + "Response_4": { "runAfter": {}, "metadata": { - "operationMetadataId": "5fb1e9d7-d829-4b1d-8daa-895dccb71412" + "operationMetadataId": "00598947-556d-4afd-8e0c-11c0310f81cc" }, - "type": "Terminate", + "type": "Response", + "kind": "Http", "inputs": { - "runStatus": "Succeeded" + "statusCode": 200 } } } }, - "expression": { - "or": [ + "expression": "@triggerBody()?['actionType']", + "metadata": { + "operationMetadataId": "5c463cf4-8eb0-443f-99c0-d7807cd879b1" + }, + "type": "Switch" + } + }, + "runAfter": { + "IsFLowSecretCorrect": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "ad624be4-2c6e-4ba6-a6ea-289d2a7b8ca9" + }, + "type": "Scope" + }, + "Catch": { + "actions": { + "FilterForFailedOrTimedOutStatus": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "ca1bedd8-7555-4a99-a290-1c22c2e6e229" + }, + "type": "Query", + "inputs": { + "from": "@result('Try')", + "where": "@or(equals(item()?['Status'], 'Failed'), equals(item()?['Status'], 'TimedOut'))" + } + }, + "CreateHtmlTable": { + "runAfter": { + "FilterForFailedOrTimedOutStatus": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "34b6a96f-64c6-43fd-89a3-fe7d5ef245ff" + }, + "type": "Table", + "inputs": { + "from": "@body('FilterForFailedOrTimedOutStatus')", + "format": "HTML", + "columns": [ { - "equals": [ - "@outputs('ApplicationDetails')['statusKey']", - "ACCEPTED" - ] + "header": "ProposalId", + "value": "@triggerBody()?['proposalId']" }, { - "equals": [ - "@outputs('ApplicationDetails')['statusKey']", - "ACCEPTED_TENTATIVE" - ] + "header": "SupervisorEmail", + "value": "@triggerBody()?['supervisorEmail']" + }, + { + "header": "ActionType", + "value": "@triggerBody()?['actionType']" + }, + { + "header": "ErrorCode", + "value": "@item()?['code']" } ] + } + }, + "Terminate_3": { + "runAfter": { + "SendFailureNotification": [ + "Succeeded" + ] }, "metadata": { - "operationMetadataId": "9bd9abc8-9ac9-4134-a2e3-72100f394b43" + "operationMetadataId": "0f41eff7-41db-4eae-8e12-46f64d545e8b" }, - "type": "If" + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + }, + "SendFailureNotification": { + "runAfter": { + "CreateHtmlTable": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e7c370de-36de-45b2-ae99-b7d0e7013242" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sendmail-2", + "operationId": "SendEmailV3", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sendmail" + }, + "parameters": { + "request/to": "@{parameters('Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)')};", + "request/subject": "(@{parameters('Environment (uzhbf_thesisplatform_environment_env_var)')}) Failure in UZH BF Thesis Platform - Thesis Proposal Feedback", + "request/text": "

@{body('CreateHtmlTable')}

" + }, + "authentication": "@parameters('$authentication')" + } } }, "runAfter": { - "ApplicationDetails": [ - "Succeeded" - ], - "ProposalDetails": [ - "Succeeded" - ], - "SupervisorDetails": [ - "Succeeded" + "Try": [ + "Failed", + "TimedOut" ] }, + "metadata": { + "operationMetadataId": "054f28a3-080c-4f8a-9529-1183121f12f9" + }, + "type": "Scope" + }, + "IsFLowSecretCorrect": { + "actions": {}, + "runAfter": {}, + "else": { + "actions": { + "Terminate_6": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "b0e5bdca-638d-4f99-bf6a-88e22b939ecb" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + } + } + }, "expression": { "equals": [ - "@triggerBody()?['actionType']", - "REFETCH" + "@triggerOutputs()['headers']['secretKey']", + "@parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')" ] }, "metadata": { - "operationMetadataId": "7d582be1-075d-4223-8d22-7c7e4fb1dd8e" + "operationMetadataId": "2e8497de-b65d-41bd-bc3e-8d913d2aba3c" }, "type": "If" } diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json.data.xml b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json.data.xml new file mode 100644 index 0000000..dddef8a --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/UZHBFThesisPlatform-ThesisProposalFeedback-4BF9872E-202A-EE11-BDF5-000D3A831DD0.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 0.0.0.1 + 1 + 0 + 1 + none + + + + \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json index 0bc0f5d..516aaef 100644 --- a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json @@ -28,22 +28,22 @@ "name": "shared_sharepointonline" } }, - "shared_onedriveforbusiness": { + "shared_office365_1": { "runtimeSource": "embedded", "connection": { - "connectionReferenceLogicalName": "uzhbf_thesisplatform_oneDrive_ref" + "connectionReferenceLogicalName": "uzhbf_thesisplatform_outlook365_ref" }, "api": { - "name": "shared_onedriveforbusiness" + "name": "shared_office365" } }, - "shared_office365_1": { + "shared_sendmail-2": { "runtimeSource": "embedded", "connection": { - "connectionReferenceLogicalName": "uzhbf_thesisplatform_outlook365_ref" + "connectionReferenceLogicalName": "uzhbf_thesisplatform_mail_ref" }, "api": { - "name": "shared_office365" + "name": "shared_sendmail" } } }, @@ -67,7 +67,7 @@ } }, "Publish Thesis Proposal Forms Id (uzhbf_thesisplatform_publish_thesis_proposal_forms_id_env_var)": { - "defaultValue": "2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFUOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QS4u", + "defaultValue": "2zjkx2LkIkypCsNYsWmAs0LFaOQJoXlHrbsK8Pa1si9UOFBGVEI2SlY2WEVQRUc0VUFIRUdKNDE5QSQlQCN0PWcu", "type": "String", "metadata": { "schemaName": "uzhbf_thesisplatform_publish_thesis_proposal_forms_id_env_var" @@ -87,13 +87,6 @@ "schemaName": "uzhbf_thesisplatform_thesis_inbox_env_var" } }, - "Topic Areas List Name (uzhbf_thesisplatform_topic_areas_list_name_env_var)": { - "defaultValue": "Topic Areas", - "type": "String", - "metadata": { - "schemaName": "uzhbf_thesisplatform_topic_areas_list_name_env_var" - } - }, "Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)": { "defaultValue": "Thesis Supervisors", "type": "String", @@ -107,6 +100,34 @@ "metadata": { "schemaName": "uzhbf_thesisplatform_proposals_document_library_name_env_var" } + }, + "Environment (uzhbf_thesisplatform_environment_env_var)": { + "defaultValue": "DEV", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_environment_env_var" + } + }, + "Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)": { + "defaultValue": "flow@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_email_failure_env_var" + } + }, + "Department (uzhbf_thesisplatform_department_env_var)": { + "defaultValue": "DBF", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_department_env_var" + } + }, + "Root URL (uzhbf_thesisplatform_root_url_env_var)": { + "defaultValue": "http://localhost:3000", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_root_url_env_var" + } } }, "triggers": { @@ -129,553 +150,924 @@ } }, "actions": { - "GetResponseDetails": { + "InitializeProposalId": { "runAfter": {}, "metadata": { - "operationMetadataId": "a4ebfb3a-cca3-40f0-ae3c-bcc1463b605d" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "form_id": "@parameters('Publish Thesis Proposal Forms Id (uzhbf_thesisplatform_publish_thesis_proposal_forms_id_env_var)')", - "response_id": "@triggerOutputs()?['body/resourceData/responseId']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_microsoftforms", - "operationId": "GetFormResponseById", - "connectionName": "shared_microsoftforms" - } - } - }, - "GenerateProposalId": { - "runAfter": { - "GetResponseDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "e7ab0158-8106-4190-8eee-bd2eddd72b96" + "operationMetadataId": "67873cd9-daa1-4506-8f4f-afd1c518e723" }, "type": "InitializeVariable", "inputs": { "variables": [ { "name": "ProposalId", - "type": "string", - "value": "@{guid()}" + "type": "string" } ] } }, - "GetMatchingUsers": { + "InitializeSupervisorEmail": { "runAfter": { - "GenerateProposalId": [ + "InitializeProposalId": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "0ba12ef9-1a14-4f00-a1cd-ef238599c322" + "operationMetadataId": "e95b9b49-06d5-4c3c-8ab2-4aefcc8dc16f" }, - "type": "OpenApiConnection", + "type": "InitializeVariable", "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[user]", - "$filter": "email eq '@{outputs('GetResponseDetails')?['body/responder']}'" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "GetItems", - "connectionName": "shared_azuremysql" - } - } - }, - "IfUserExists": { - "actions": {}, - "runAfter": { - "GetMatchingUsers": [ - "Succeeded" - ] - }, - "else": { - "actions": { - "PersistNewUser": { - "metadata": { - "operationMetadataId": "5e447837-c6a0-4b84-bd3d-46efd8c4f5ba" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[user]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/email": "@outputs('GetResponseDetails')?['body/responder']", - "item/id": "@guid()", - "item/name": "Anonymous", - "item/role": "SUPERVISOR", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } + "variables": [ + { + "name": "SupervisorEmail", + "type": "string" } - } - }, - "expression": { - "greater": [ - "@length(body('GetMatchingUsers')['value'])", - 0 ] - }, - "metadata": { - "operationMetadataId": "c3ab16c6-9dd8-4538-bc92-c9281ec2ed1d" - }, - "type": "If" - }, - "GetSupervisors": { - "runAfter": { - "GenerateProposalId": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "5ed3ba8d-d9c6-462a-8c1a-04cb56e2b4b7" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')", - "$filter": "field_1 eq '@{outputs('GetResponseDetails')?['body/ra234958191ee49a28a4fc68389dd0ce2']}'", - "$top": 1 - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "GetItems", - "connectionName": "shared_sharepointonline" - } } }, - "SetSupervisorEmail": { + "InitializeTopicArea": { "runAfter": { - "GetSupervisors": [ + "InitializeSupervisorEmail": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "f9ea5082-3cd5-468c-905d-889a1200e698" + "operationMetadataId": "86a0ff6b-0ad7-4176-a775-8140f15fb26a" }, "type": "InitializeVariable", "inputs": { "variables": [ { - "name": "SupervisorEmail", - "type": "string", - "value": "@{first(body('GetSupervisors')['value'])['Title']}" + "name": "TopicArea", + "type": "string" } ] } }, - "GetTopicAreas": { - "runAfter": { - "GenerateProposalId": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "48306085-4df9-4c51-b4b1-2d6de6dc0395" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Topic Areas List Name (uzhbf_thesisplatform_topic_areas_list_name_env_var)')", - "$filter": "Title eq '@{outputs('GetResponseDetails')?['body/r2a41d1ed540f418caa89f10a35cdb069']}'", - "$top": 1 - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "GetItems", - "connectionName": "shared_sharepointonline" - } - } - }, - "SetTopicAreaDetails": { + "InitializeProposalPdfName": { "runAfter": { - "GetTopicAreas": [ + "InitializeTopicArea": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "908e7f8f-b3ec-459f-827a-fbee27dc6938" + "operationMetadataId": "53c3620d-45cc-4519-9722-9781fd23386f" }, "type": "InitializeVariable", "inputs": { "variables": [ { - "name": "TopicAreaDetails", - "type": "object", - "value": "@first(body('GetTopicAreas')['value'])" + "name": "ProposalPDFName", + "type": "string" } ] } }, - "ParseProposalPDF": { - "runAfter": { - "GenerateProposalId": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "fa91e1d7-7937-4285-8fc3-677cb8bf6a7c" - }, - "type": "ParseJson", - "inputs": { - "content": "@outputs('GetResponseDetails')?['body/rdde59a23cc104fc7b93e394925f30168']", - "schema": { - "items": { - "properties": { - "driveId": { - "type": "string" + "Try": { + "actions": { + "GetResponseDetails": { + "metadata": { + "operationMetadataId": "a4ebfb3a-cca3-40f0-ae3c-bcc1463b605d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "form_id": "@parameters('Publish Thesis Proposal Forms Id (uzhbf_thesisplatform_publish_thesis_proposal_forms_id_env_var)')", + "response_id": "@triggerOutputs()?['body/resourceData/responseId']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_microsoftforms", + "operationId": "GetFormResponseById", + "connectionName": "shared_microsoftforms" + } + } + }, + "SetProposalId": { + "runAfter": { + "GetResponseDetails": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "529ff450-b0d9-46cb-8014-8b375da2ca7e" + }, + "type": "SetVariable", + "inputs": { + "name": "ProposalId", + "value": "@{guid()}" + } + }, + "GetMatchingUsers": { + "runAfter": { + "SetProposalId": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0ba12ef9-1a14-4f00-a1cd-ef238599c322" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[user]", + "$filter": "email eq '@{outputs('GetResponseDetails')?['body/responder']}'" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "GetItems", + "connectionName": "shared_azuremysql" + } + } + }, + "IfUserExists": { + "actions": {}, + "runAfter": { + "GetMatchingUsers": [ + "Succeeded" + ] + }, + "else": { + "actions": { + "PersistNewUser": { + "metadata": { + "operationMetadataId": "5e447837-c6a0-4b84-bd3d-46efd8c4f5ba" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[user]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/email": "@outputs('GetResponseDetails')?['body/responder']", + "item/id": "@guid()", + "item/name": "Anonymous", + "item/role": "SUPERVISOR", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + } + } + }, + "expression": { + "greater": [ + "@length(body('GetMatchingUsers')['value'])", + 0 + ] + }, + "metadata": { + "operationMetadataId": "c3ab16c6-9dd8-4538-bc92-c9281ec2ed1d" + }, + "type": "If" + }, + "GetSupervisors": { + "runAfter": { + "SetProposalId": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5ed3ba8d-d9c6-462a-8c1a-04cb56e2b4b7" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')", + "$filter": "Name eq '@{outputs('GetResponseDetails')?['body/ra234958191ee49a28a4fc68389dd0ce2']}'", + "$top": 1 + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetItems", + "connectionName": "shared_sharepointonline" + } + } + }, + "SetSupervisorEmail": { + "runAfter": { + "GetSupervisors": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "2059bc6b-37e7-4256-b83b-7e5f0e6c33ac" + }, + "type": "SetVariable", + "inputs": { + "name": "SupervisorEmail", + "value": "@{first(body('GetSupervisors')['value'])['Email']}" + } + }, + "IsProposalPdfAttached": { + "actions": { + "ParseProposalPDF": { + "metadata": { + "operationMetadataId": "fa91e1d7-7937-4285-8fc3-677cb8bf6a7c" }, - "id": { - "type": "string" + "type": "ParseJson", + "inputs": { + "content": "@outputs('GetResponseDetails')?['body/rdde59a23cc104fc7b93e394925f30168']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} + }, + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } + } + }, + "SetProposalPdfName": { + "runAfter": { + "ParseProposalPDF": [ + "Succeeded" + ] }, - "link": { - "type": "string" + "metadata": { + "operationMetadataId": "ca060dab-9368-4d1a-9f33-f0015cadcdd2" }, - "name": { - "type": "string" + "type": "SetVariable", + "inputs": { + "name": "ProposalPDFName", + "value": "@{first(body('ParseProposalPDF'))?['name']}" + } + }, + "PersistProposalPDF": { + "runAfter": { + "GetProposalFileContentUsingPath": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "73d10613-2f21-405c-94f2-a864355e8d60" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}.pdf", + "body": "@body('GetProposalFileContentUsingPath')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "CreateShareLinkProposalPDF": { + "runAfter": { + "PersistProposalPDF": [ + "Succeeded" + ] }, - "referenceId": { - "type": "string" + "metadata": { + "operationMetadataId": "c63fa1e6-f889-4076-b4d1-47638b03d785" }, - "size": { - "type": "integer" + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistProposalPDF')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline" + } + } + }, + "PersistProposalAttachment": { + "runAfter": { + "CreateShareLinkProposalPDF": [ + "Succeeded" + ] }, - "status": { - "type": "integer" + "metadata": { + "operationMetadataId": "2e44e2bf-bb36-4238-8ab8-7804f6a6725d" }, - "type": {}, - "uploadSessionUrl": {} + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalattachment]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/href": "@outputs('CreateShareLinkProposalPDF')?['body/link/webUrl']", + "item/id": "@{guid()}", + "item/name": "Proposal", + "item/proposalId": "@variables('ProposalId')", + "item/type": "@outputs('PersistProposalPDF')?['body/MediaType']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } }, - "required": [ - "name", - "link", - "id", - "type", - "size", - "referenceId", - "driveId", - "status", - "uploadSessionUrl" + "GetProposalFileContentUsingPath": { + "runAfter": { + "SetProposalPdfName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6a4d4b80-363c-4fa2-987a-c6ffe1eb477d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Publish Thesis Proposal/Research Proposal (PDF)/@{variables('ProposalPDFName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline" + } + } + } + }, + "runAfter": { + "SetProposalId": [ + "Succeeded" + ] + }, + "else": { + "actions": {} + }, + "expression": { + "not": { + "equals": [ + "@outputs('GetResponseDetails')?['body/rdde59a23cc104fc7b93e394925f30168']", + "" + ] + } + }, + "metadata": { + "operationMetadataId": "a4c8c8ae-151d-4349-9dfc-5fd8ee44e922" + }, + "type": "If" + }, + "GetMatchingSupervisor": { + "runAfter": { + "SetSupervisorEmail": [ + "Succeeded" ], - "type": "object" + "IfUserExists": [ + "Succeeded" + ] }, - "type": "array" - } - } - }, - "ExtractProposalPDFName": { - "runAfter": { - "ParseProposalPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "6168e8c3-e6fc-40c3-9af4-7a37c36cdb5a" - }, - "type": "InitializeVariable", - "inputs": { - "variables": [ - { - "name": "ProposalPDFName", - "type": "string", - "value": "@{first(body('ParseProposalPDF'))?['name']}" + "metadata": { + "operationMetadataId": "ecae3a00-da6c-48dd-a659-a020e89065e7" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[user]", + "$filter": "Email eq '@{variables('SupervisorEmail')}'", + "$top": 1 + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "GetItems", + "connectionName": "shared_azuremysql" + } } - ] - } - }, - "GetFileUploadProposalPDF": { - "runAfter": { - "ExtractProposalPDFName": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "339b9272-47e6-4510-8a05-dad3e41ab01d" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "path": "/Apps/Microsoft Forms/Publish Thesis Proposal/Research Proposal (PDF)/@{variables('ProposalPDFName')}", - "inferContentType": true }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", - "operationId": "GetFileContentByPath", - "connectionName": "shared_onedriveforbusiness" - } - } - }, - "PersistProposalPDF": { - "runAfter": { - "GetFileUploadProposalPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "73d10613-2f21-405c-94f2-a864355e8d60" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", - "name": "@{variables('ProposalId')}.pdf", - "body": "@body('GetFileUploadProposalPDF')" + "IfSupervisorExists": { + "actions": {}, + "runAfter": { + "GetMatchingSupervisor": [ + "Succeeded" + ] + }, + "else": { + "actions": { + "PersistNewSupervisor": { + "metadata": { + "operationMetadataId": "0bc44550-c738-4962-afd9-8944446555e6" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[user]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/email": "@variables('SupervisorEmail')", + "item/id": "@guid()", + "item/name": "@outputs('GetResponseDetails')?['body/ra234958191ee49a28a4fc68389dd0ce2']", + "item/role": "SUPERVISOR", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + } + } + }, + "expression": { + "greater": [ + "@length(body('GetMatchingSupervisor')['value'])", + 0 + ] + }, + "metadata": { + "operationMetadataId": "c369f54e-1077-42b2-ab0c-b64862ab1b57" + }, + "type": "If" }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateFile", - "connectionName": "shared_sharepointonline" - } - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" - } - } - }, - "CreateShareLinkProposalPDF": { - "runAfter": { - "PersistProposalPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "c63fa1e6-f889-4076-b4d1-47638b03d785" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", - "id": "@outputs('PersistProposalPDF')?['body/ItemId']", - "permission/type": "view", - "permission/scope": "organization" + "PersistProposal": { + "runAfter": { + "SetTopicArea": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "29966d86-05ac-472a-a145-9be54394940c" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/description": "@outputs('GetResponseDetails')?['body/rc6188bd68e4d4ab19206e5e06dd703be']", + "item/id": "@variables('ProposalId')", + "item/language": "@outputs('GetResponseDetails')?['body/rb26c844ff536435a9abf2fae9d962082']", + "item/statusKey": "OPEN", + "item/studyLevel": "@outputs('GetResponseDetails')?['body/r93c920c31aaf4b8f8ca5e55bb9a0bf87']", + "item/title": "@outputs('GetResponseDetails')?['body/r2b3875d21899474a988a886e0d5b3621']", + "item/topicAreaSlug": "@replace(toLower(variables('TopicArea')),' ','_')", + "item/typeKey": "SUPERVISOR", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/ownedByUserEmail": "@outputs('GetResponseDetails')?['body/responder']", + "item/timeFrame": "@outputs('GetResponseDetails')?['body/r564b7a6cc5bf42ffb900990d26246c80']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateSharingLink", - "connectionName": "shared_sharepointonline" - } - } - }, - "GetMatchingSupervisor": { - "runAfter": { - "IfUserExists": [ - "Succeeded" - ], - "SetSupervisorEmail": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "ecae3a00-da6c-48dd-a659-a020e89065e7" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[user]", - "$filter": "Email eq '@{variables('SupervisorEmail')}'", - "$top": 1 + "PersistProposalSupervision": { + "runAfter": { + "PersistProposal": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "d310ff8e-6f06-4cbc-bcaf-924e1974cdf2" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[userproposalsupervision]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/id": "@variables('ProposalId')", + "item/proposalId": "@variables('ProposalId')", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/studyLevel": "@outputs('GetResponseDetails')?['body/r93c920c31aaf4b8f8ca5e55bb9a0bf87']", + "item/supervisorEmail": "@variables('SupervisorEmail')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "GetItems", - "connectionName": "shared_azuremysql" - } - } - }, - "IfSupervisorExists": { - "actions": {}, - "runAfter": { - "GetMatchingSupervisor": [ - "Succeeded" - ] - }, - "else": { - "actions": { - "PersistNewSupervisor": { - "metadata": { - "operationMetadataId": "0bc44550-c738-4962-afd9-8944446555e6" + "SupervisorConfirmationEmail": { + "runAfter": { + "PersistProposalSupervision": [ + "Succeeded" + ], + "IsProposalPdfAttached": [ + "Succeeded" + ], + "HasFurtherAttachments": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "daa4cff2-ecb1-4b41-b8b0-5d29d315a3ea" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@variables('SupervisorEmail')", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Your Proposal was posted", + "emailMessage/Body": "

Your proposal on \"@{outputs('GetResponseDetails')?['body/r2b3875d21899474a988a886e0d5b3621']}\" was posted on the @{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Platform. You will be notified as soon as applications are received.
\n
\nThe proposal is visible on @{parameters('Root URL (uzhbf_thesisplatform_root_url_env_var)')}/@{variables('ProposalId')}.
\n
\nIf you have any further remarks, please contact the @{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator by replying to this email.
\n
\nBest regards,
\n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator

", + "emailMessage/Cc": "@outputs('GetResponseDetails')?['body/responder']", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/ReplyTo": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Importance": "Normal" }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[user]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/email": "@variables('SupervisorEmail')", - "item/id": "@guid()", - "item/name": "@outputs('GetResponseDetails')?['body/ra234958191ee49a28a4fc68389dd0ce2']", - "item/role": "SUPERVISOR", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", + "operationId": "SharedMailboxSendEmailV2", + "connectionName": "shared_office365_1" + } + } + }, + "SetTopicArea": { + "runAfter": { + "IfSupervisorExists": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e71bf2e5-143e-4c24-a190-83399d562950" + }, + "type": "SetVariable", + "inputs": { + "name": "TopicArea", + "value": "@outputs('GetResponseDetails')?['body/r2a41d1ed540f418caa89f10a35cdb069']" + } + }, + "HasFurtherAttachments": { + "actions": { + "ApplyToEach": { + "foreach": "@body('ParseJSON')", + "actions": { + "GetLinkToFile": { + "metadata": { + "operationMetadataId": "0e847db9-e416-4943-b305-529db20f62cb" + }, + "type": "Compose", + "inputs": "@items('ApplyToEach')['link']" + }, + "GetFileName": { + "runAfter": { + "GetLinkToFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "fad18ee5-cd8e-4dd8-aaf2-883784aac189" + }, + "type": "Compose", + "inputs": "@items('ApplyToEach')['name']" + }, + "GetFurtherFileContentUsingPath": { + "runAfter": { + "GetFileName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6a4d4b80-363c-4fa2-987a-c6ffe1eb477d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Publish Thesis Proposal/Further Attachments/@{outputs('GetFileName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline" + } + } + }, + "PersistAdditionalFile": { + "runAfter": { + "GetFurtherFileContentUsingPath": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "73d10613-2f21-405c-94f2-a864355e8d60" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}_@{outputs('GetFileName')}", + "body": "@body('GetFurtherFileContentUsingPath')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "CreateShareLinkAttachment": { + "runAfter": { + "PersistAdditionalFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c63fa1e6-f889-4076-b4d1-47638b03d785" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistAdditionalFile')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline" + } + } + }, + "PersistFurtherAttachment": { + "runAfter": { + "CreateShareLinkAttachment": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "2e44e2bf-bb36-4238-8ab8-7804f6a6725d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalattachment]", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/href": "@outputs('CreateShareLinkAttachment')?['body/link/webUrl']", + "item/id": "@{guid()}", + "item/name": "Attachment", + "item/proposalId": "@variables('ProposalId')", + "item/type": "@outputs('PersistAdditionalFile')?['body/MediaType']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + } + }, + "runAfter": { + "ParseJSON": [ + "Succeeded" + ] }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" + "metadata": { + "operationMetadataId": "c1a920f2-cb46-419f-ad59-992d59f90e69" + }, + "type": "Foreach" + }, + "ParseJSON": { + "metadata": { + "operationMetadataId": "82579673-fcb0-46ba-85f7-2f3ceef9100f" + }, + "type": "ParseJson", + "inputs": { + "content": "@outputs('GetResponseDetails')?['body/r0ef08ac303644c3982b9c360d95d0025']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} + }, + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } } } - } + }, + "runAfter": { + "SetProposalId": [ + "Succeeded" + ] + }, + "else": { + "actions": {} + }, + "expression": { + "not": { + "equals": [ + "@outputs('GetResponseDetails')?['body/r0ef08ac303644c3982b9c360d95d0025']", + "" + ] + } + }, + "metadata": { + "operationMetadataId": "5c34f61b-22b4-4ea3-9b2e-1dc34152a758" + }, + "type": "If" } }, - "expression": { - "greater": [ - "@length(body('GetMatchingSupervisor')['value'])", - 0 - ] - }, - "metadata": { - "operationMetadataId": "c369f54e-1077-42b2-ab0c-b64862ab1b57" - }, - "type": "If" - }, - "PersistProposal": { "runAfter": { - "SetTopicAreaDetails": [ - "Succeeded" - ], - "IfSupervisorExists": [ + "InitializeProposalPdfName": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "29966d86-05ac-472a-a145-9be54394940c" + "operationMetadataId": "c6409f3d-dcb2-43dd-b9fc-82dfb5e57771" }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/description": "@outputs('GetResponseDetails')?['body/rc6188bd68e4d4ab19206e5e06dd703be']", - "item/id": "@variables('ProposalId')", - "item/language": "@outputs('GetResponseDetails')?['body/rb26c844ff536435a9abf2fae9d962082']", - "item/statusKey": "OPEN", - "item/studyLevel": "@outputs('GetResponseDetails')?['body/r93c920c31aaf4b8f8ca5e55bb9a0bf87']", - "item/title": "@outputs('GetResponseDetails')?['body/r2b3875d21899474a988a886e0d5b3621']", - "item/topicAreaSlug": "@variables('TopicAreaDetails')['Slug']", - "item/typeKey": "SUPERVISOR", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/ownedByUserEmail": "@outputs('GetResponseDetails')?['body/responder']", - "item/timeFrame": "@outputs('GetResponseDetails')?['body/r564b7a6cc5bf42ffb900990d26246c80']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } + "type": "Scope" }, - "PersistProposalSupervision": { - "runAfter": { - "PersistProposal": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "d310ff8e-6f06-4cbc-bcaf-924e1974cdf2" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[userproposalsupervision]", - "item/id": "@variables('ProposalId')", - "item/proposalId": "@variables('ProposalId')", - "item/studyLevel": "@outputs('GetResponseDetails')?['body/r93c920c31aaf4b8f8ca5e55bb9a0bf87']", - "item/supervisorEmail": "@variables('SupervisorEmail')" + "Catch": { + "actions": { + "FilterForFailedOrTimedOutStatus": { + "metadata": { + "operationMetadataId": "ca1bedd8-7555-4a99-a290-1c22c2e6e229" + }, + "type": "Query", + "inputs": { + "from": "@result('Try')", + "where": "@or(equals(item()?['Status'], 'Failed'), equals(item()?['Status'], 'TimedOut'))" + } }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } - }, - "PersistProposalAttachment": { - "runAfter": { - "PersistProposalSupervision": [ - "Succeeded" - ], - "CreateShareLinkProposalPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "2e44e2bf-bb36-4238-8ab8-7804f6a6725d" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalattachment]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/href": "@outputs('CreateShareLinkProposalPDF')?['body/link/webUrl']", - "item/id": "@{guid()}", - "item/name": "Proposal", - "item/proposalId": "@variables('ProposalId')", - "item/type": "@outputs('PersistProposalPDF')?['body/MediaType']", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + "CreateHtmlTable": { + "runAfter": { + "FilterForFailedOrTimedOutStatus": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "34b6a96f-64c6-43fd-89a3-fe7d5ef245ff" + }, + "type": "Table", + "inputs": { + "from": "@body('FilterForFailedOrTimedOutStatus')", + "format": "HTML", + "columns": [ + { + "header": "ProposalId", + "value": "@triggerBody()?['proposalId']" + }, + { + "header": "ProposalTitle", + "value": "@outputs('GetResponseDetails')?['body/r2b3875d21899474a988a886e0d5b3621']" + }, + { + "header": "SubmittedBy", + "value": "@outputs('GetResponseDetails')?['body/responder']" + }, + { + "header": "ErrorCode", + "value": "@item()?['code']" + } + ] + } }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" + "Terminate": { + "runAfter": { + "SendFailureNotification": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0f41eff7-41db-4eae-8e12-46f64d545e8b" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } + }, + "SendFailureNotification": { + "runAfter": { + "CreateHtmlTable": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e7c370de-36de-45b2-ae99-b7d0e7013242" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "request/to": "@{parameters('Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)')};", + "request/subject": "(@{parameters('Environment (uzhbf_thesisplatform_environment_env_var)')}) Failure in UZH BF Thesis Platform - Thesis Proposal Posting", + "request/text": "

@{body('CreateHtmlTable')}

" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sendmail", + "operationId": "SendEmailV3", + "connectionName": "shared_sendmail-2" + } + } } - } - }, - "SupervisorConfirmationEmail": { + }, "runAfter": { - "PersistProposalAttachment": [ - "Succeeded" + "Try": [ + "Failed", + "TimedOut" ] }, "metadata": { - "operationMetadataId": "daa4cff2-ecb1-4b41-b8b0-5d29d315a3ea" + "operationMetadataId": "054f28a3-080c-4f8a-9529-1183121f12f9" }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@variables('SupervisorEmail')", - "emailMessage/Subject": "DBF Theses - Your Proposal was posted", - "emailMessage/Body": "

Your proposal on \"@{outputs('GetResponseDetails')?['body/r2b3875d21899474a988a886e0d5b3621']}\" was posted on the DBF Thesis Platform. You will be notified as soon as applications are received.
\n
\nThe proposal is visible on https://theses.bf.uzh.ch/?supervisor=true&proposalId=@{variables('ProposalId')}.
\n
\nIf you have any further remarks, please contact the DBF Thesis Coordinator by replying to this email.
\n
\nBest regards,
\nDBF Thesis Coordinator

", - "emailMessage/Cc": "@outputs('GetResponseDetails')?['body/responder']", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/ReplyTo": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/Importance": "Normal" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", - "operationId": "SharedMailboxSendEmailV2", - "connectionName": "shared_office365_1" - } - } + "type": "Scope" } } }, diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json.data.xml b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json.data.xml new file mode 100644 index 0000000..f6e90e5 --- /dev/null +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/UZHBFThesisPlatform-ThesisProposalPosting-F3E0B1EB-152A-EE11-BDF5-000D3A831DD0.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 0.0.0.1 + 1 + 0 + 1 + none + + + + \ No newline at end of file diff --git a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalSubmission-D12D741B-A027-EE11-9966-000D3A8321BD.json b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalSubmission-D12D741B-A027-EE11-9966-000D3A8321BD.json index a053fd8..14b9c55 100644 --- a/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalSubmission-D12D741B-A027-EE11-9966-000D3A8321BD.json +++ b/solutions/UZHBFThesisPlatform/Workflows/UZHBFThesisPlatform-ThesisProposalSubmission-D12D741B-A027-EE11-9966-000D3A8321BD.json @@ -28,13 +28,13 @@ "name": "shared_azuremysql" } }, - "shared_onedriveforbusiness_1": { + "shared_sharepointonline": { "runtimeSource": "embedded", "connection": { - "connectionReferenceLogicalName": "uzhbf_thesisplatform_oneDrive_ref" + "connectionReferenceLogicalName": "uzhbf_thesisplatform_sharePoint_ref" }, "api": { - "name": "shared_onedriveforbusiness" + "name": "shared_sharepointonline" } }, "shared_office365_1": { @@ -45,6 +45,15 @@ "api": { "name": "shared_office365" } + }, + "shared_sendmail-2": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "uzhbf_thesisplatform_mail_ref" + }, + "api": { + "name": "shared_sendmail" + } } }, "definition": { @@ -67,7 +76,7 @@ } }, "Submit Thesis Proposal Forms Id (uzhbf_thesisplatform_submit_thesis_proposal_forms_id_env_var)": { - "defaultValue": "2zjkx2LkIkypCsNYsWmAs1QgPDYXFIJFoTn3sHbg3YFURUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMS4u", + "defaultValue": "2zjkx2LkIkypCsNYsWmAs0LFaOQJoXlHrbsK8Pa1si9URUhYTFNWUUdTT0lVUFRCVkJUVEsyWTdBMSQlQCN0PWcu", "type": "String", "metadata": { "schemaName": "uzhbf_thesisplatform_submit_thesis_proposal_forms_id_env_var" @@ -101,13 +110,6 @@ "schemaName": "uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var" } }, - "Topic Areas List Name (uzhbf_thesisplatform_topic_areas_list_name_env_var)": { - "defaultValue": "Topic Areas", - "type": "String", - "metadata": { - "schemaName": "uzhbf_thesisplatform_topic_areas_list_name_env_var" - } - }, "Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)": { "defaultValue": "Thesis Supervisors", "type": "String", @@ -121,6 +123,34 @@ "metadata": { "schemaName": "uzhbf_thesisplatform_proposals_document_library_name_env_var" } + }, + "Environment (uzhbf_thesisplatform_environment_env_var)": { + "defaultValue": "DEV", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_environment_env_var" + } + }, + "Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)": { + "defaultValue": "flow@bf.uzh.ch", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_email_failure_env_var" + } + }, + "Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)": { + "defaultValue": "abcd", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_flow_secret_env_var" + } + }, + "Department (uzhbf_thesisplatform_department_env_var)": { + "defaultValue": "DBF", + "type": "String", + "metadata": { + "schemaName": "uzhbf_thesisplatform_department_env_var" + } } }, "triggers": { @@ -143,30 +173,8 @@ } }, "actions": { - "GetResponseDetails": { - "runAfter": {}, - "metadata": { - "operationMetadataId": "d7a6dd06-5c53-41d1-966b-2d312f30fe3a" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "form_id": "@parameters('Submit Thesis Proposal Forms Id (uzhbf_thesisplatform_submit_thesis_proposal_forms_id_env_var)')", - "response_id": "@triggerOutputs()?['body/resourceData/responseId']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_microsoftforms", - "operationId": "GetFormResponseById", - "connectionName": "shared_microsoftforms" - } - } - }, "InitializeProposalId": { - "runAfter": { - "GetResponseDetails": [ - "Succeeded" - ] - }, + "runAfter": {}, "metadata": { "operationMetadataId": "4ae19faf-62a6-4fcd-a3ef-8c80f977ec92" }, @@ -175,8 +183,7 @@ "variables": [ { "name": "ProposalId", - "type": "string", - "value": "@{guid()}" + "type": "string" } ] } @@ -195,13 +202,12 @@ "variables": [ { "name": "Originator", - "type": "string", - "value": "@parameters('Originator (uzhbf_thesisplatform_originator_env_var)')" + "type": "string" } ] } }, - "InitializeMatchingSupervisor": { + "InitializeMatchingSupervisors": { "runAfter": { "InitializeOriginator": [ "Succeeded" @@ -222,7 +228,7 @@ }, "InitializeWasSpecificRequest": { "runAfter": { - "InitializeMatchingSupervisor": [ + "InitializeMatchingSupervisors": [ "Succeeded" ] }, @@ -234,42 +240,17 @@ "variables": [ { "name": "WasSpecificRequest", - "type": "boolean", - "value": false + "type": "boolean" } ] } }, - "TopicAreas": { + "InitializeTopicArea": { "runAfter": { "InitializeWasSpecificRequest": [ "Succeeded" ] }, - "metadata": { - "operationMetadataId": "ea08e293-d266-49aa-b9e6-adced5938564" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Topic Areas List Name (uzhbf_thesisplatform_topic_areas_list_name_env_var)')", - "$filter": "Title eq '@{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}'", - "$top": 1 - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "GetItems", - "connectionName": "shared_sharepointonline_1" - } - } - }, - "InitializeTopicAreaDetails": { - "runAfter": { - "TopicAreas": [ - "Succeeded" - ] - }, "metadata": { "operationMetadataId": "a71cc778-3ab4-4397-8f6b-a2d86e5858e0" }, @@ -277,552 +258,1380 @@ "inputs": { "variables": [ { - "name": "TopicAreaDetails", - "type": "object", - "value": "@first(body('TopicAreas')?['value'])" - } - ] - } - }, - "ForEachAreaSupervisor": { - "foreach": "@variables('TopicAreaDetails')['Supervisors']", - "actions": { - "AreaSupervisorDetails": { - "metadata": { - "operationMetadataId": "6e7a457b-5766-48ec-87c8-8f473fdd327c" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')", - "id": "@items('ForEachAreaSupervisor')?['ID']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "GetItem", - "connectionName": "shared_sharepointonline_1" - } - } - }, - "Append_to_array_variable": { - "runAfter": { - "AreaSupervisorDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "718cf67d-b738-474b-8492-0cdc54dde8fb" - }, - "type": "AppendToArrayVariable", - "inputs": { - "name": "MatchingSupervisors", - "value": "@outputs('AreaSupervisorDetails')?['body/Title']" + "name": "TopicArea", + "type": "string" } - } - }, - "runAfter": { - "InitializeTopicAreaDetails": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "c8b1bdac-53b0-4199-9748-0e5884e131ab" - }, - "type": "Foreach" - }, - "PersistProposalToDB": { - "runAfter": { - "ForEachAreaSupervisor": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "7d90cba3-0cba-448a-a6f3-1bd130f7eed9" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposal]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/description": "@outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']", - "item/id": "@variables('ProposalId')", - "item/language": "@outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']", - "item/statusKey": "OPEN", - "item/studyLevel": "@outputs('GetResponseDetails')?['body/rc797ecd1491b44a0ac091174abbac9f6']", - "item/title": "@outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']", - "item/topicAreaSlug": "@variables('TopicAreaDetails')['Slug']", - "item/typeKey": "STUDENT", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } - }, - "PersistApplicationToDB": { - "runAfter": { - "PersistProposalToDB": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "fdff0e9f-8f24-4928-bc5f-18b23777b378" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalapplication]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/email": "@outputs('GetResponseDetails')?['body/responder']", - "item/fullName": "@outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']", - "item/id": "@outputs('PersistProposalToDB')?['body/id']", - "item/matriculationNumber": "@outputs('GetResponseDetails')?['body/r6c3b387342aa4bd0b5f423aa43662850']", - "item/motivation": "@outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']", - "item/plannedStartAt": "@outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']", - "item/proposalId": "@outputs('PersistProposalToDB')?['body/id']", - "item/statusKey": "OPEN", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } - }, - "ParseFileUploadProposalPDF": { - "runAfter": { - "PersistApplicationToDB": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "5702afa2-f3b2-4293-85b7-c1c553782920" - }, - "type": "ParseJson", - "inputs": { - "content": "@outputs('GetResponseDetails')?['body/r97c7d5dddc1c46149360e60cee1c31b2']", - "schema": { - "items": { - "properties": { - "driveId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "name": { - "type": "string" - }, - "referenceId": { - "type": "string" - }, - "size": { - "type": "integer" - }, - "status": { - "type": "integer" - }, - "type": {}, - "uploadSessionUrl": {} - }, - "required": [ - "name", - "link", - "id", - "type", - "size", - "referenceId", - "driveId", - "status", - "uploadSessionUrl" - ], - "type": "object" - }, - "type": "array" - } - } - }, - "ParsePersonalCVPDF": { - "runAfter": { - "PersistApplicationToDB": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "eae9f188-4fd6-450d-a4f1-4bb6b0efb139" - }, - "type": "ParseJson", - "inputs": { - "content": "@outputs('GetResponseDetails')?['body/r36080bd39649467ca994ab4b0435ebbe']", - "schema": { - "items": { - "properties": { - "driveId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "name": { - "type": "string" - }, - "referenceId": { - "type": "string" - }, - "size": { - "type": "integer" - }, - "status": { - "type": "integer" - }, - "type": {}, - "uploadSessionUrl": {} - }, - "required": [ - "name", - "link", - "id", - "type", - "size", - "referenceId", - "driveId", - "status", - "uploadSessionUrl" - ], - "type": "object" - }, - "type": "array" - } - } - }, - "ParseTranscriptPDF": { - "runAfter": { - "PersistApplicationToDB": [ - "Succeeded" ] - }, - "metadata": { - "operationMetadataId": "c48ec50d-be41-451e-881b-564d5026744c" - }, - "type": "ParseJson", - "inputs": { - "content": "@outputs('GetResponseDetails')?['body/rd29a58b86f3541de8de84ed702dd0eec']", - "schema": { - "items": { - "properties": { - "driveId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "name": { - "type": "string" - }, - "referenceId": { - "type": "string" - }, - "size": { - "type": "integer" - }, - "status": { - "type": "integer" - }, - "type": {}, - "uploadSessionUrl": {} - }, - "required": [ - "name", - "link", - "id", - "type", - "size", - "referenceId", - "driveId", - "status", - "uploadSessionUrl" - ], - "type": "object" - }, - "type": "array" - } } }, - "ExtractProposalPDFName": { + "InitializeProposalPdfName": { "runAfter": { - "ParseFileUploadProposalPDF": [ + "InitializeTopicArea": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "35adc576-9010-4690-9d76-81a40985f436" + "operationMetadataId": "081090d7-8e0f-4a42-a33d-3ef0a55f02b7" }, "type": "InitializeVariable", "inputs": { "variables": [ { "name": "ProposalPDFName", - "type": "string", - "value": "@{first(body('ParseFileUploadProposalPDF'))?['name']}" + "type": "string" } ] } }, - "GetFileUploadProposalPDF": { + "InitializePersonalCvPdfName": { "runAfter": { - "ExtractProposalPDFName": [ + "InitializeProposalPdfName": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "fc42a6f8-0ab5-470e-9768-b94ffce6ecbf" + "operationMetadataId": "8c4d455b-8d02-48e8-9d61-0adb91880fa7" }, - "type": "OpenApiConnection", + "type": "InitializeVariable", "inputs": { - "parameters": { - "path": "/Apps/Microsoft Forms/Submit Thesis Proposal/Research Proposal (MS Word or PDF)/@{variables('ProposalPDFName')}", - "inferContentType": true - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", - "operationId": "GetFileContentByPath", - "connectionName": "shared_onedriveforbusiness_1" - } - } - }, - "PersistProposalFile": { - "runAfter": { - "GetFileUploadProposalPDF": [ - "Succeeded" + "variables": [ + { + "name": "PersonalCVPDFName", + "type": "string" + } ] - }, - "metadata": { - "operationMetadataId": "14d5659d-ec2a-4436-a3e4-164bf6e1422e" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", - "name": "@{variables('ProposalId')}_proposal_@{variables('ProposalPDFName')}", - "body": "@body('GetFileUploadProposalPDF')" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateFile", - "connectionName": "shared_sharepointonline_1" - } - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" - } } }, - "ShareLinkProposalFile": { + "InitializeTranscriptPdfName": { "runAfter": { - "PersistProposalFile": [ + "InitializePersonalCvPdfName": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "97073148-ecee-4222-bc02-d5463a009fb0" + "operationMetadataId": "f133a716-39de-4de8-b3bc-bb87b070eacd" }, - "type": "OpenApiConnection", + "type": "InitializeVariable", "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", - "id": "@outputs('PersistProposalFile')?['body/ItemId']", - "permission/type": "view", - "permission/scope": "organization" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateSharingLink", - "connectionName": "shared_sharepointonline_1" - } - } - }, - "CreateProposalAttachment": { - "runAfter": { - "ShareLinkProposalFile": [ - "Succeeded" + "variables": [ + { + "name": "TranscriptPDFName", + "type": "string" + } ] - }, - "metadata": { - "operationMetadataId": "e3eb6ad7-b695-48b4-8f21-2c10c4ab6b96" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[proposalattachment]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/href": "@outputs('ShareLinkProposalFile')?['body/link/webUrl']", - "item/id": "@{guid()}", - "item/name": "Proposal", - "item/proposalId": "@variables('ProposalId')", - "item/type": "@outputs('PersistProposalFile')?['body/MediaType']", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } } }, - "EmailToSupervisors": { - "foreach": "@variables('MatchingSupervisors')", + "Try": { "actions": { - "AdaptiveCard": { + "GetResponseDetails": { "metadata": { - "operationMetadataId": "fe7ccff6-5733-4c75-8c50-ce0674dbd1b1" + "operationMetadataId": "d7a6dd06-5c53-41d1-966b-2d312f30fe3a" }, - "type": "Compose", + "type": "OpenApiConnection", "inputs": { - "type": "AdaptiveCard", - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "version": "1.0", - "originator": "@{variables('Originator')}", - "body": [ - { - "type": "TextBlock", - "text": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}", - "wrap": true, - "weight": "Bolder", - "size": "Medium" - }, - { - "type": "TextBlock", - "text": "@{outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']}", - "wrap": true - }, - { - "type": "TextBlock", - "text": "@{outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']}", - "wrap": true - }, - { - "type": "FactSet", - "facts": [ - { - "title": "Submitted By", - "value": "@{outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']} (@{outputs('GetResponseDetails')?['body/r6c3b387342aa4bd0b5f423aa43662850']}, @{outputs('GetResponseDetails')?['body/responder']})" - }, - { - "title": "Proposed Title", - "value": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}" - }, - { - "title": "Type of Proposal", - "value": "@{outputs('GetResponseDetails')?['body/rc797ecd1491b44a0ac091174abbac9f6']}" - }, - { - "title": "Field of Research", - "value": "@{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}" - }, - { - "title": "Proposal Language", - "value": "@{outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']}" - }, - { - "title": "Planned Start Date", - "value": "@{outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']}" - } - ], - "separator": true - } - ], - "actions": [ - { - "type": "Action.ShowCard", - "title": "Accept", - "card": { - "type": "AdaptiveCard", - "body": [ - { - "type": "TextBlock", - "text": "Once you accept this proposal, the student will be asked to verify the matching. The proposal will be removed from the proposal market and assigned to you for supervision.", - "wrap": true - }, - { - "type": "Input.Text", - "placeholder": "Your message will be sent to the student alongside your acceptance notification.", - "id": "acceptComment", - "isRequired": true, - "errorMessage": "Field required", - "label": "Comment" - } - ], - "actions": [ - { - "type": "Action.Http", - "title": "Submit", - "method": "POST", - "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", - "body": "{\"actionType\": \"ACCEPT\", \"comment\": \"{{acceptComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", - "headers": [ - { - "name": "Authorization", - "value": "" - }, - { - "name": "Content-type", - "value": "application/json" - } - ] + "parameters": { + "form_id": "@parameters('Submit Thesis Proposal Forms Id (uzhbf_thesisplatform_submit_thesis_proposal_forms_id_env_var)')", + "response_id": "@triggerOutputs()?['body/resourceData/responseId']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_microsoftforms", + "operationId": "GetFormResponseById", + "connectionName": "shared_microsoftforms" + } + } + }, + "SetProposalId": { + "runAfter": { + "GetResponseDetails": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "a9bc3897-2eca-441e-b401-0ef359b2ffcb" + }, + "type": "SetVariable", + "inputs": { + "name": "ProposalId", + "value": "@{guid()}" + } + }, + "SetOriginator": { + "runAfter": { + "SetProposalId": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b85d8d03-1af3-43cf-9f22-e42b942ff725" + }, + "type": "SetVariable", + "inputs": { + "name": "Originator", + "value": "@parameters('Originator (uzhbf_thesisplatform_originator_env_var)')" + } + }, + "SetWasSpecificRequest": { + "runAfter": { + "SetOriginator": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "0b047e5f-a866-4479-b0a4-5d90658c0cfe" + }, + "type": "SetVariable", + "inputs": { + "name": "WasSpecificRequest", + "value": false + } + }, + "SupervisorList": { + "runAfter": { + "SetWasSpecificRequest": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "ea08e293-d266-49aa-b9e6-adced5938564" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Supervisors List Name (uzhbf_thesisplatform_supervisors_list_name_env_var)')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetItems", + "connectionName": "shared_sharepointonline_1" + } + } + }, + "SetTopicArea": { + "runAfter": { + "SupervisorList": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "193e9122-5159-45ea-9788-9348d2f829ad" + }, + "type": "SetVariable", + "inputs": { + "name": "TopicArea", + "value": "@outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']" + } + }, + "PersistProposalToDB": { + "runAfter": { + "ForEachSupervisor": [ + "Succeeded", + "TimedOut" + ] + }, + "metadata": { + "operationMetadataId": "7d90cba3-0cba-448a-a6f3-1bd130f7eed9" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposal]", + "item/id": "@variables('ProposalId')", + "item/title": "@outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']", + "item/description": "@outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']", + "item/language": "@outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']", + "item/studyLevel": "@outputs('GetResponseDetails')?['body/rc797ecd1491b44a0ac091174abbac9f6']", + "item/topicAreaSlug": "@replace(toLower(variables('TopicArea')),' ','_')", + "item/typeKey": "STUDENT", + "item/statusKey": "OPEN", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/additionalStudentComment": "@body('GetResponseDetails')?['r036f3f6320bc47e5b8c3694816ffe095']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "PersistApplicationToDB": { + "runAfter": { + "PersistProposalToDB": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "fdff0e9f-8f24-4928-bc5f-18b23777b378" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalapplication]", + "item/id": "@outputs('PersistProposalToDB')?['body/id']", + "item/statusKey": "OPEN", + "item/email": "@outputs('GetResponseDetails')?['body/responder']", + "item/matriculationNumber": "@outputs('GetResponseDetails')?['body/r6c3b387342aa4bd0b5f423aa43662850']", + "item/fullName": "@outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']", + "item/plannedStartAt": "@outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']", + "item/motivation": "@outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']", + "item/proposalId": "@outputs('PersistProposalToDB')?['body/id']", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "ParseFileUploadProposalPDF": { + "runAfter": { + "PersistApplicationToDB": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5702afa2-f3b2-4293-85b7-c1c553782920" + }, + "type": "ParseJson", + "inputs": { + "content": "@outputs('GetResponseDetails')?['body/r97c7d5dddc1c46149360e60cee1c31b2']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} + }, + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } + } + }, + "ParsePersonalCVPDF": { + "runAfter": { + "PersistApplicationToDB": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "eae9f188-4fd6-450d-a4f1-4bb6b0efb139" + }, + "type": "ParseJson", + "inputs": { + "content": "@outputs('GetResponseDetails')?['body/r36080bd39649467ca994ab4b0435ebbe']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} + }, + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } + } + }, + "ParseTranscriptPDF": { + "runAfter": { + "PersistApplicationToDB": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c48ec50d-be41-451e-881b-564d5026744c" + }, + "type": "ParseJson", + "inputs": { + "content": "@outputs('GetResponseDetails')?['body/rd29a58b86f3541de8de84ed702dd0eec']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} + }, + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } + } + }, + "SetProposalPdfName": { + "runAfter": { + "ParseFileUploadProposalPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "74877f03-bb0b-44eb-afcb-5d1a8d91c64d" + }, + "type": "SetVariable", + "inputs": { + "name": "ProposalPDFName", + "value": "@{first(body('ParseFileUploadProposalPDF'))?['name']}" + } + }, + "PersistProposalFile": { + "runAfter": { + "GetProposalFileContentUsingPath": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "14d5659d-ec2a-4436-a3e4-164bf6e1422e" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}_proposal_@{variables('ProposalPDFName')}", + "body": "@body('GetProposalFileContentUsingPath')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline_1" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "ShareLinkProposalFile": { + "runAfter": { + "PersistProposalFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "97073148-ecee-4222-bc02-d5463a009fb0" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistProposalFile')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline_1" + } + } + }, + "SetPersonalCvPdfName": { + "runAfter": { + "ParsePersonalCVPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "1f71a2b8-c445-4495-8bfd-f06d5d687972" + }, + "type": "SetVariable", + "inputs": { + "name": "PersonalCVPDFName", + "value": "@{first(body('ParsePersonalCVPDF'))?['name']}" + } + }, + "PersistCVPDF": { + "runAfter": { + "GetCVFileContentUsingPath": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5addcee8-04fe-48e5-aa5b-e73aa3bf0b27" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}_cv_@{variables('PersonalCVPDFName')}", + "body": "@body('GetCVFileContentUsingPath')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline_1" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "ShareLinkCVPDF": { + "runAfter": { + "PersistCVPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "f98fbe3a-7eae-42a9-9aec-2a4950006e98" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistCVPDF')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline_1" + } + } + }, + "SetTranscriptPdfName": { + "runAfter": { + "ParseTranscriptPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "748c8af6-c8e9-4914-a67c-7900bc26e727" + }, + "type": "SetVariable", + "inputs": { + "name": "TranscriptPDFName", + "value": "@{first(body('ParseTranscriptPDF'))?['name']}" + } + }, + "PersistTranscriptPDF": { + "runAfter": { + "GetTranscriptFileContentUsingPath_": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c15d6cd9-aa79-4e96-bab0-c70a00a42518" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}_transcript_@{variables('TranscriptPDFName')}", + "body": "@body('GetTranscriptFileContentUsingPath_')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline_1" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "ShareLinkTranscriptPDF": { + "runAfter": { + "PersistTranscriptPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5aa84c0a-2fdd-4b42-a54a-9d0e05c65856" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistTranscriptPDF')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline_1" + } + } + }, + "CreateProposalAttachment": { + "runAfter": { + "ShareLinkProposalFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e3eb6ad7-b695-48b4-8f21-2c10c4ab6b96" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[proposalattachment]", + "item/id": "@{guid()}", + "item/name": "Proposal", + "item/href": "@outputs('ShareLinkProposalFile')?['body/link/webUrl']", + "item/type": "@outputs('PersistProposalFile')?['body/MediaType']", + "item/proposalId": "@variables('ProposalId')", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "CreateCVAttachment": { + "runAfter": { + "ShareLinkCVPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "edca8bce-6316-4cee-b027-83094e1b5a19" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[applicationattachment]", + "item/id": "@{guid()}", + "item/name": "CV", + "item/href": "@outputs('ShareLinkCVPDF')?['body/link/webUrl']", + "item/type": "@outputs('PersistCVPDF')?['body/MediaType']", + "item/proposalApplicationId": "@outputs('PersistApplicationToDB')?['body/id']", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "CreateTranscriptAttachment": { + "runAfter": { + "ShareLinkTranscriptPDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6023d5d8-64fd-4511-812e-c3f1f0b1bd8f" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[applicationattachment]", + "item/id": "@{guid()}", + "item/name": "Transcript", + "item/href": "@outputs('ShareLinkTranscriptPDF')?['body/link/webUrl']", + "item/type": "@outputs('PersistTranscriptPDF')?['body/MediaType']", + "item/proposalApplicationId": "@outputs('PersistApplicationToDB')?['body/id']", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "ForEachSupervisor": { + "foreach": "@outputs('SupervisorList')?['body/value']", + "actions": { + "ForEachAreaOfInterest": { + "foreach": "@items('ForEachSupervisor')?['AreasOfInterest']", + "actions": { + "IsSupervisingTopicArea": { + "actions": { + "AppendToMatchingSupervisors": { + "metadata": { + "operationMetadataId": "c2e44021-c939-4132-a7da-e0d1b23020cd" + }, + "type": "AppendToArrayVariable", + "inputs": { + "name": "MatchingSupervisors", + "value": "@items('ForEachSupervisor')?['Email']" + } } - ] + }, + "else": { + "actions": {} + }, + "expression": { + "and": [ + { + "equals": [ + "@items('ForEachAreaOfinterest')?['Value']", + "@variables('TopicArea')" + ] + }, + { + "equals": [ + "@outputs('GetEmailNotificationEnabled')", + "y" + ] + } + ] + }, + "metadata": { + "operationMetadataId": "0b3c57ab-9365-4f2e-88e1-09f66daff6f0" + }, + "type": "If" } }, - { - "type": "Action.ShowCard", - "title": "Accept (Tentative)", - "card": { - "type": "AdaptiveCard", - "body": [ - { - "type": "TextBlock", - "text": "When you accept the proposal tentatively, the student will receive your feedback and is required to improve the proposal before you finally accept the proposal for supervision.", - "wrap": true + "runAfter": { + "GetEmailNotificationEnabled": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "3cdcdaa5-8261-4fbc-9cc8-80f431b3c204" + }, + "type": "Foreach" + }, + "GetEmailNotificationEnabled": { + "type": "Compose", + "inputs": "@items('ForEachSupervisor')['EmailNotification']?['Value']" + } + }, + "runAfter": { + "SetTopicArea": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "2a8c2544-f8b6-40be-8842-9a8104fc0fc1" + }, + "type": "Foreach" + }, + "GetProposalFileContentUsingPath": { + "runAfter": { + "SetProposalPdfName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6a4d4b80-363c-4fa2-987a-c6ffe1eb477d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Submit Thesis Proposal/Research Proposal (MS Word or PDF)/@{variables('ProposalPDFName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline" + } + } + }, + "GetCVFileContentUsingPath": { + "runAfter": { + "SetPersonalCvPdfName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6a4d4b80-363c-4fa2-987a-c6ffe1eb477d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Submit Thesis Proposal/Personal CV (PDF)/@{variables('PersonalCVPDFName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline" + } + } + }, + "GetTranscriptFileContentUsingPath_": { + "runAfter": { + "SetTranscriptPdfName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6a4d4b80-363c-4fa2-987a-c6ffe1eb477d" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Submit Thesis Proposal/Transcript of Records (PDF)/@{variables('TranscriptPDFName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline" + } + } + }, + "HasFurtherAttachments": { + "actions": { + "ParseJSON": { + "metadata": { + "operationMetadataId": "eab6a594-1385-4e5e-b663-fb671444906b" + }, + "type": "ParseJson", + "inputs": { + "content": "@body('GetResponseDetails')?['r03afe1c9ab4547a18b4bdbff6418b128']", + "schema": { + "items": { + "properties": { + "driveId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referenceId": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "type": {}, + "uploadSessionUrl": {} }, - { - "type": "Input.Text", - "placeholder": "Your message will be sent to the student alongside your notification of interest.", - "id": "tentativeComment", - "label": "Comment", - "isMultiline": true, - "isRequired": true, - "errorMessage": "Field required" + "required": [ + "name", + "link", + "id", + "type", + "size", + "referenceId", + "driveId", + "status", + "uploadSessionUrl" + ], + "type": "object" + }, + "type": "array" + } + } + }, + "ApplyToEach": { + "foreach": "@body('ParseJSON')", + "actions": { + "GetLinkToFile": { + "metadata": { + "operationMetadataId": "b70302ea-adc9-4092-b37f-76fc3cd2822d" + }, + "type": "Compose", + "inputs": "@items('ApplyToEach')['link']" + }, + "GetFileName": { + "runAfter": { + "GetLinkToFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "478500e3-9558-49b7-99e0-f2dc3d7a2f6a" + }, + "type": "Compose", + "inputs": "@items('ApplyToEach')['name']" + }, + "GetFurtherFileContentUsingPath": { + "runAfter": { + "GetFileName": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4edb2b43-d449-44b1-9912-1402f0964deb" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "path": "Shared Documents/Apps/Microsoft Forms/Submit Thesis Proposal/Further Attachments/@{outputs('GetFileName')}", + "inferContentType": true + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "GetFileContentByPath", + "connectionName": "shared_sharepointonline_1" } - ], - "actions": [ - { + } + }, + "PersistAdditionalFile": { + "runAfter": { + "GetFurtherFileContentUsingPath": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "73d10613-2f21-405c-94f2-a864355e8d60" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", + "name": "@{variables('ProposalId')}_attachment_@{outputs('GetFileName')}", + "body": "@body('GetFurtherFileContentUsingPath')" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateFile", + "connectionName": "shared_sharepointonline" + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "ShareLinkAttachment": { + "runAfter": { + "PersistAdditionalFile": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5aa84c0a-2fdd-4b42-a54a-9d0e05c65856" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", + "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", + "id": "@outputs('PersistAdditionalFile')?['body/ItemId']", + "permission/type": "view", + "permission/scope": "organization" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "operationId": "CreateSharingLink", + "connectionName": "shared_sharepointonline_1" + } + } + }, + "CreateFurtherAttachment": { + "runAfter": { + "ShareLinkAttachment": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6023d5d8-64fd-4511-812e-c3f1f0b1bd8f" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "server": "default", + "database": "default", + "table": "[main].[applicationattachment]", + "item/id": "@{guid()}", + "item/name": "Attachment", + "item/href": "@outputs('ShareLinkAttachment')?['body/link/webUrl']", + "item/type": "@outputs('PersistAdditionalFile')?['body/MediaType']", + "item/proposalApplicationId": "@outputs('PersistApplicationToDB')?['body/id']", + "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", + "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", + "operationId": "PostItem", + "connectionName": "shared_azuremysql" + } + } + }, + "AppendAttachmentLinkToArray": { + "runAfter": { + "CreateFurtherAttachment": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "74ef45a8-c5b8-4f87-9837-66f24094a7b3" + }, + "type": "AppendToArrayVariable", + "inputs": { + "name": "links", + "value": { + "type": "Action.OpenUrl", + "title": "Attachment", + "url": "@{outputs('ShareLinkAttachment')?['body/link/webUrl']}" + } + } + }, + "AppendAttachmentLinkToString": { + "runAfter": { + "AppendAttachmentLinkToArray": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "df7b500c-36cc-469c-ad57-998fba723271" + }, + "type": "AppendToStringVariable", + "inputs": { + "name": "linksAsList", + "value": "
  • @{outputs('ShareLinkAttachment')?['body/link/webUrl']}
  • " + } + } + }, + "runAfter": { + "ParseJSON": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "7bf6e852-4c83-4f54-9d6f-0d383f6a1a19" + }, + "type": "Foreach" + }, + "EmailToSupervisorsWithAttachments": { + "foreach": "@variables('MatchingSupervisors')", + "actions": { + "AdaptiveCardWithAttachments": { + "metadata": { + "operationMetadataId": "fe7ccff6-5733-4c75-8c50-ce0674dbd1b1" + }, + "type": "Compose", + "inputs": { + "type": "AdaptiveCard", + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "version": "1.3", + "originator": "@{variables('Originator')}", + "body": [ + { + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}", + "wrap": true, + "weight": "Bolder", + "size": "Medium" + }, + { + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']}", + "wrap": true + }, + { + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']}", + "wrap": true + }, + { + "type": "FactSet", + "facts": [ + { + "title": "Submitted By", + "value": "@{outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']} (@{outputs('GetResponseDetails')?['body/r6c3b387342aa4bd0b5f423aa43662850']}, @{outputs('GetResponseDetails')?['body/responder']})" + }, + { + "title": "Proposed Title", + "value": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}" + }, + { + "title": "Type of Proposal", + "value": "@{outputs('GetResponseDetails')?['body/rc797ecd1491b44a0ac091174abbac9f6']}" + }, + { + "title": "Field of Research", + "value": "@{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}" + }, + { + "title": "Proposal Language", + "value": "@{outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']}" + }, + { + "title": "Planned Start Date", + "value": "@{outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']}" + }, + { + "title": "Additional Comment", + "value": "@{outputs('GetResponseDetails')?['body/r036f3f6320bc47e5b8c3694816ffe095']}" + } + ], + "separator": true + }, + { + "type": "ActionSet", + "actions": "@variables('links')" + } + ], + "actions": [ + { + "type": "Action.ShowCard", + "title": "Accept", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Once you accept this proposal, the student will be asked to verify the matching. The proposal will be removed from the proposal market and assigned to you for supervision.", + "wrap": true + }, + { + "type": "Input.Text", + "placeholder": "Your message will be sent to the student alongside your acceptance notification.", + "id": "acceptComment", + "isRequired": true, + "errorMessage": "Field required", + "label": "Comment" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"ACCEPT\", \"comment\": \"{{acceptComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisorsWithAttachments')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + }, + { + "type": "Action.ShowCard", + "title": "Accept (Tentative)", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "When you accept the proposal tentatively, the student will receive your feedback and is required to improve the proposal before you finally accept the proposal for supervision.", + "wrap": true + }, + { + "type": "Input.Text", + "placeholder": "Your message will be sent to the student alongside your notification of interest.", + "id": "tentativeComment", + "label": "Comment", + "isMultiline": true, + "isRequired": true, + "errorMessage": "Field required" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"ACCEPT_TENTATIVE\", \"comment\": \"{{tentativeComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisorsWithAttachments')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + }, + { + "type": "Action.ShowCard", + "title": "Reject", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Rejecting this proposal because of lacking content quality or format requirements will cause review by the thesis coordinator. The student will need to improve and resubmit the proposal.", + "wrap": true + }, + { + "type": "Input.ChoiceSet", + "choices": [ + { + "title": "Proposal too broad", + "value": "TOO_BROAD" + }, + { + "title": "Proposal not sufficiently scientific", + "value": "NOT_SCIENTIFIC" + }, + { + "title": "Proposal or scope not clear", + "value": "NOT_CLEAR" + }, + { + "title": "Format unsuitable", + "value": "FORMAT_UNSUITABLE" + }, + { + "title": "Mismatch in topic area", + "value": "TOPIC_AREA_INVALID" + } + ], + "placeholder": "Why should this proposal be rejected?", + "isRequired": true, + "id": "rejectReason", + "errorMessage": "Field required", + "label": "Reason" + }, + { + "type": "Input.Text", + "placeholder": "Why do you recommend this proposal for rejection? Your comment will not be shown to the student.", + "id": "rejectComment", + "isRequired": true, + "errorMessage": "Field required", + "label": "Comment", + "isMultiline": true + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"REJECT\", \"comment\": \"{{rejectComment.value}}\", \n\"reason\": \"{{rejectReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisorsWithAttachments')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + }, + { + "type": "Action.ShowCard", + "title": "Decline", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Declining this proposal because of a mismatch of interests or a high workload on your side will keep it available for other supervisors.", + "wrap": true + }, + { + "type": "Input.ChoiceSet", + "choices": [ + { + "title": "Lack of interest in specific topic", + "value": "LACKING_INTEREST" + }, + { + "title": "Personal workload too high", + "value": "PERSONAL_WORKLOAD" + }, + { + "title": "Mismatch in language", + "value": "LANGUAGE" + } + ], + "placeholder": "Why do you want to decline this proposal?", + "id": "declineReason", + "label": "Reason", + "isRequired": true, + "errorMessage": "Field required" + }, + { + "type": "Input.Text", + "placeholder": "Why do you decline this proposal specifically? Your comment will not be shown to the student.", + "id": "declineComment", + "label": "Comment", + "isMultiline": true, + "isRequired": true, + "errorMessage": "Field required" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"DECLINE\", \"comment\": \"{{declineComment.value}}\", \n\"reason\": \"{{declineReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisorsWithAttachments')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + } + ], + "autoInvokeAction": { "type": "Action.Http", - "title": "Submit", "method": "POST", "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", - "body": "{\"actionType\": \"ACCEPT_TENTATIVE\", \"comment\": \"{{tentativeComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "body": "{\"actionType\": \"REFETCH\",\"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisorsWithAttachments')}\"}", "headers": [ { "name": "Authorization", @@ -831,528 +1640,737 @@ { "name": "Content-type", "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" } ] } - ] - } - }, - { - "type": "Action.ShowCard", - "title": "Reject", - "card": { - "type": "AdaptiveCard", - "body": [ - { - "type": "TextBlock", - "text": "Rejecting this proposal because of lacking content quality or format requirements will cause review by the thesis coordinator. The student will need to improve and resubmit the proposal.", - "wrap": true - }, - { - "type": "Input.ChoiceSet", - "choices": [ - { - "title": "Proposal too broad", - "value": "TOO_BROAD" - }, - { - "title": "Proposal not sufficiently scientific", - "value": "NOT_SCIENTIFIC" - }, - { - "title": "Proposal or scope not clear", - "value": "NOT_CLEAR" - }, + } + }, + "EmailContentsWithAttachments": { + "runAfter": { + "AdaptiveCardWithAttachments": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4a75e677-4358-4992-a664-ffe5b41e0922" + }, + "type": "Compose", + "inputs": "" + }, + "SupervisorInformationEmailWithAttachments": { + "runAfter": { + "EmailContentsWithAttachments": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "ca5e164f-cb5e-4a62-9467-189c5311ca33" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@items('EmailToSupervisorsWithAttachments')", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - New Proposal for Review (@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']})", + "emailMessage/Body": "@outputs('EmailContentsWithAttachments')", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Attachments": [ { - "title": "Format unsuitable", - "value": "FORMAT_UNSUITABLE" + "Name": "@variables('PersonalCVPDFName')", + "ContentBytes": "@body('GetCVFileContentUsingPath')" }, { - "title": "Mismatch in topic area", - "value": "TOPIC_AREA_INVALID" - } - ], - "placeholder": "Why should this proposal be rejected?", - "isRequired": true, - "id": "rejectReason", - "errorMessage": "Field required", - "label": "Reason" - }, - { - "type": "Input.Text", - "placeholder": "Why do you recommend this proposal for rejection? Your comment will not be shown to the student.", - "id": "rejectComment", - "isRequired": true, - "errorMessage": "Field required", - "label": "Comment", - "isMultiline": true - } - ], - "actions": [ - { - "type": "Action.Http", - "title": "Submit", - "method": "POST", - "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", - "body": "{\"actionType\": \"REJECT\", \"comment\": \"{{rejectComment.value}}\", \n\"reason\": \"{{rejectReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", - "headers": [ - { - "name": "Authorization", - "value": "" + "Name": "@variables('TranscriptPDFName')", + "ContentBytes": "@body('GetTranscriptFileContentUsingPath_')" }, { - "name": "Content-type", - "value": "application/json" + "Name": "@variables('ProposalPDFName')", + "ContentBytes": "@body('GetProposalFileContentUsingPath')" } - ] + ], + "emailMessage/ReplyTo": "@outputs('GetResponseDetails')?['body/responder']", + "emailMessage/Importance": "High" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", + "operationId": "SharedMailboxSendEmailV2", + "connectionName": "shared_office365_1" } - ] + } } }, - { - "type": "Action.ShowCard", - "title": "Decline", - "card": { - "type": "AdaptiveCard", - "body": [ + "runAfter": { + "AppendListClosing": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "59fc0f49-7782-4696-b7cb-f1b30f3402ea" + }, + "type": "Foreach" + }, + "StudentConfirmationEmailWithAttachments": { + "runAfter": { + "EmailToSupervisorsWithAttachments": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "956b2cfb-109b-4b96-b61d-4431cd5de8f4" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@outputs('GetResponseDetails')?['body/responder']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Your Proposal has been received (@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']})", + "emailMessage/Body": "

    Dear @{outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']},
    \n
    \nWe have received your thesis proposal with the information as provided below. Please keep in mind that the thesis matching process usually takes about one month, but might take less or more depending on the workload of our supervisors. You will hear from us as soon as the proposal has been matched to a supervisor or if any further action from your side should be required.
    \n
    \nIf you have any urgent questions, please contact our @{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator by replying to this email.
    \n
    \nBest regards,
    \n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator
    \n
    \n---
    \n
    \nSubmitted By: @{outputs('GetResponseDetails')?['body/submitDate']} (@{outputs('GetResponseDetails')?['body/responder']})
    \n
    \nProposed Title: @{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}
    \nThesis Language: @{outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']}
    \nField of Research: @{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}
    \nPlanned Start Date: @{outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']}
    \n
    \nSummary: @{outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']}
    \nMotivation: @{outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']}
    \n
    \nFurther Attachments: @{variables('linksAsList')}

    ", + "emailMessage/Attachments": [ + { + "Name": "@variables('PersonalCVPDFName')", + "ContentBytes": "@body('GetCVFileContentUsingPath')" + }, { - "type": "TextBlock", - "text": "Declining this proposal because of a mismatch of interests or a high workload on your side will keep it available for other supervisors.", - "wrap": true + "Name": "@variables('TranscriptPDFName')", + "ContentBytes": "@body('GetTranscriptFileContentUsingPath_')" }, { - "type": "Input.ChoiceSet", - "choices": [ + "Name": "@variables('ProposalPDFName')", + "ContentBytes": "@body('GetProposalFileContentUsingPath')" + } + ], + "emailMessage/ReplyTo": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Importance": "High" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", + "operationId": "SharedMailboxSendEmailV2", + "connectionName": "shared_office365_1" + } + } + }, + "AppendListClosing": { + "runAfter": { + "ApplyToEach": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5e201a86-23eb-49cf-a67a-0c2fc4acce69" + }, + "type": "AppendToStringVariable", + "inputs": { + "name": "linksAsList", + "value": "" + } + } + }, + "runAfter": { + "CreateCVAttachment": [ + "Succeeded" + ], + "CreateProposalAttachment": [ + "Succeeded" + ], + "CreateTranscriptAttachment": [ + "Succeeded" + ], + "PersistApplicationToDB": [ + "Succeeded" + ] + }, + "else": { + "actions": { + "EmailToSupervisors": { + "foreach": "@variables('MatchingSupervisors')", + "actions": { + "AdaptiveCard": { + "metadata": { + "operationMetadataId": "fe7ccff6-5733-4c75-8c50-ce0674dbd1b1" + }, + "type": "Compose", + "inputs": { + "type": "AdaptiveCard", + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "version": "1.3", + "originator": "@{variables('Originator')}", + "body": [ + { + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}", + "wrap": true, + "weight": "Bolder", + "size": "Medium" + }, { - "title": "Lack of interest in specific topic", - "value": "LACKING_INTEREST" + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']}", + "wrap": true }, { - "title": "Personal workload too high", - "value": "PERSONAL_WORKLOAD" + "type": "TextBlock", + "text": "@{outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']}", + "wrap": true }, { - "title": "Mismatch in language", - "value": "LANGUAGE" + "type": "FactSet", + "facts": [ + { + "title": "Submitted By", + "value": "@{outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']} (@{outputs('GetResponseDetails')?['body/r6c3b387342aa4bd0b5f423aa43662850']}, @{outputs('GetResponseDetails')?['body/responder']})" + }, + { + "title": "Proposed Title", + "value": "@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}" + }, + { + "title": "Type of Proposal", + "value": "@{outputs('GetResponseDetails')?['body/rc797ecd1491b44a0ac091174abbac9f6']}" + }, + { + "title": "Field of Research", + "value": "@{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}" + }, + { + "title": "Proposal Language", + "value": "@{outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']}" + }, + { + "title": "Planned Start Date", + "value": "@{outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']}" + }, + { + "title": "Additional Comment", + "value": "@{outputs('GetResponseDetails')?['body/r036f3f6320bc47e5b8c3694816ffe095']}" + } + ], + "separator": true } ], - "placeholder": "Why do you want to decline this proposal?", - "id": "declineReason", - "label": "Reason", - "isRequired": true, - "errorMessage": "Field required" - }, - { - "type": "Input.Text", - "placeholder": "Why do you decline this proposal specifically? Your comment will not be shown to the student.", - "id": "declineComment", - "label": "Comment", - "isMultiline": true, - "isRequired": true, - "errorMessage": "Field required" - } - ], - "actions": [ - { - "type": "Action.Http", - "title": "Submit", - "method": "POST", - "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", - "body": "{\"actionType\": \"DECLINE\", \"comment\": \"{{declineComment.value}}\", \n\"reason\": \"{{declineReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", - "headers": [ + "actions": [ { - "name": "Authorization", - "value": "" + "type": "Action.ShowCard", + "title": "Accept", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Once you accept this proposal, the student will be asked to verify the matching. The proposal will be removed from the proposal market and assigned to you for supervision.", + "wrap": true + }, + { + "type": "Input.Text", + "placeholder": "Your message will be sent to the student alongside your acceptance notification.", + "id": "acceptComment", + "isRequired": true, + "errorMessage": "Field required", + "label": "Comment" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"ACCEPT\", \"comment\": \"{{acceptComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } }, { - "name": "Content-type", - "value": "application/json" + "type": "Action.ShowCard", + "title": "Accept (Tentative)", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "When you accept the proposal tentatively, the student will receive your feedback and is required to improve the proposal before you finally accept the proposal for supervision.", + "wrap": true + }, + { + "type": "Input.Text", + "placeholder": "Your message will be sent to the student alongside your notification of interest.", + "id": "tentativeComment", + "label": "Comment", + "isMultiline": true, + "isRequired": true, + "errorMessage": "Field required" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"ACCEPT_TENTATIVE\", \"comment\": \"{{tentativeComment.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + }, + { + "type": "Action.ShowCard", + "title": "Reject", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Rejecting this proposal because of lacking content quality or format requirements will cause review by the thesis coordinator. The student will need to improve and resubmit the proposal.", + "wrap": true + }, + { + "type": "Input.ChoiceSet", + "choices": [ + { + "title": "Proposal too broad", + "value": "TOO_BROAD" + }, + { + "title": "Proposal not sufficiently scientific", + "value": "NOT_SCIENTIFIC" + }, + { + "title": "Proposal or scope not clear", + "value": "NOT_CLEAR" + }, + { + "title": "Format unsuitable", + "value": "FORMAT_UNSUITABLE" + }, + { + "title": "Mismatch in topic area", + "value": "TOPIC_AREA_INVALID" + } + ], + "placeholder": "Why should this proposal be rejected?", + "isRequired": true, + "id": "rejectReason", + "errorMessage": "Field required", + "label": "Reason" + }, + { + "type": "Input.Text", + "placeholder": "Why do you recommend this proposal for rejection? Your comment will not be shown to the student.", + "id": "rejectComment", + "isRequired": true, + "errorMessage": "Field required", + "label": "Comment", + "isMultiline": true + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"REJECT\", \"comment\": \"{{rejectComment.value}}\", \n\"reason\": \"{{rejectReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } + }, + { + "type": "Action.ShowCard", + "title": "Decline", + "card": { + "type": "AdaptiveCard", + "body": [ + { + "type": "TextBlock", + "text": "Declining this proposal because of a mismatch of interests or a high workload on your side will keep it available for other supervisors.", + "wrap": true + }, + { + "type": "Input.ChoiceSet", + "choices": [ + { + "title": "Lack of interest in specific topic", + "value": "LACKING_INTEREST" + }, + { + "title": "Personal workload too high", + "value": "PERSONAL_WORKLOAD" + }, + { + "title": "Mismatch in language", + "value": "LANGUAGE" + } + ], + "placeholder": "Why do you want to decline this proposal?", + "id": "declineReason", + "label": "Reason", + "isRequired": true, + "errorMessage": "Field required" + }, + { + "type": "Input.Text", + "placeholder": "Why do you decline this proposal specifically? Your comment will not be shown to the student.", + "id": "declineComment", + "label": "Comment", + "isMultiline": true, + "isRequired": true, + "errorMessage": "Field required" + } + ], + "actions": [ + { + "type": "Action.Http", + "title": "Submit", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"DECLINE\", \"comment\": \"{{declineComment.value}}\", \n\"reason\": \"{{declineReason.value}}\", \"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + ] + } } + ], + "autoInvokeAction": { + "type": "Action.Http", + "method": "POST", + "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", + "body": "{\"actionType\": \"REFETCH\",\"proposalId\": \"@{variables('ProposalId')}\",\"supervisorEmail\": \"@{items('EmailToSupervisors')}\"}", + "headers": [ + { + "name": "Authorization", + "value": "" + }, + { + "name": "Content-type", + "value": "application/json" + }, + { + "name": "secretkey", + "value": "@{parameters('Flow Secret (uzhbf_thesisplatform_flow_secret_env_var)')}" + } + ] + } + } + }, + "EmailContents": { + "runAfter": { + "AdaptiveCard": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4a75e677-4358-4992-a664-ffe5b41e0922" + }, + "type": "Compose", + "inputs": "" + }, + "SupervisorInformationEmail": { + "runAfter": { + "EmailContents": [ + "Succeeded" ] + }, + "metadata": { + "operationMetadataId": "ca5e164f-cb5e-4a62-9467-189c5311ca33" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@items('EmailToSupervisors')", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - New Proposal for Review (@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']})", + "emailMessage/Body": "@outputs('EmailContents')", + "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Attachments": [ + { + "Name": "@variables('PersonalCVPDFName')", + "ContentBytes": "@body('GetCVFileContentUsingPath')" + }, + { + "Name": "@variables('TranscriptPDFName')", + "ContentBytes": "@body('GetTranscriptFileContentUsingPath_')" + }, + { + "Name": "@variables('ProposalPDFName')", + "ContentBytes": "@body('GetProposalFileContentUsingPath')" + } + ], + "emailMessage/ReplyTo": "@outputs('GetResponseDetails')?['body/responder']", + "emailMessage/Importance": "High" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", + "operationId": "SharedMailboxSendEmailV2", + "connectionName": "shared_office365_1" + } } + } + }, + "metadata": { + "operationMetadataId": "59fc0f49-7782-4696-b7cb-f1b30f3402ea" + }, + "type": "Foreach" + }, + "StudentConfirmationEmail": { + "runAfter": { + "EmailToSupervisors": [ + "Succeeded" ] - } - } - ], - "autoInvokeAction": { - "type": "Action.Http", - "method": "POST", - "url": "@{parameters('Http Trigger Thesis Proposal Feedback (uzhbf_thesisplatform_http_trigger_thesis_proposal_feedback_env_var)')}", - "body": "{\"actionType\": \"REFETCH\",\"proposalId\": \"@{variables('ProposalId')}\"}", - "headers": [ - { - "name": "Authorization", - "value": "" }, - { - "name": "Content-type", - "value": "application/json" + "metadata": { + "operationMetadataId": "956b2cfb-109b-4b96-b61d-4431cd5de8f4" + }, + "type": "OpenApiConnection", + "inputs": { + "parameters": { + "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", + "emailMessage/To": "@outputs('GetResponseDetails')?['body/responder']", + "emailMessage/Subject": "@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Theses - Your Proposal has been received (@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']})", + "emailMessage/Body": "

    Dear @{outputs('GetResponseDetails')?['body/r7844031f633e4dd49368b0c116ad148d']},
    \n
    \nWe have received your thesis proposal with the information as provided below. Please keep in mind that the thesis matching process usually takes about one month, but might take less or more depending on the workload of our supervisors. You will hear from us as soon as the proposal has been matched to a supervisor or if any further action from your side should be required.
    \n
    \nIf you have any urgent questions, please contact our @{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator by replying to this email.
    \n
    \nBest regards,
    \n@{parameters('Department (uzhbf_thesisplatform_department_env_var)')} Thesis Coordinator
    \n
    \n---
    \n
    \nSubmitted By: @{outputs('GetResponseDetails')?['body/submitDate']} (@{outputs('GetResponseDetails')?['body/responder']})
    \n
    \nProposed Title: @{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']}
    \nThesis Language: @{outputs('GetResponseDetails')?['body/r8b7f3f4a7502459598d155e9b31eb25e']}
    \nField of Research: @{outputs('GetResponseDetails')?['body/r975d59f3f5114998b6e30c56c035334b']}
    \nPlanned Start Date: @{outputs('GetResponseDetails')?['body/r837fec8c113c4851a217e947217c5b7f']}
    \n
    \nSummary: @{outputs('GetResponseDetails')?['body/r7425856917f245efbd0c4cb2a7f0c434']}
    \nMotivation: @{outputs('GetResponseDetails')?['body/r60d760e8828645cc84d8fde2a6fe3b27']}

    ", + "emailMessage/Attachments": [ + { + "Name": "@variables('PersonalCVPDFName')", + "ContentBytes": "@body('GetCVFileContentUsingPath')" + }, + { + "Name": "@variables('TranscriptPDFName')", + "ContentBytes": "@body('GetTranscriptFileContentUsingPath_')" + }, + { + "Name": "@variables('ProposalPDFName')", + "ContentBytes": "@body('GetProposalFileContentUsingPath')" + } + ], + "emailMessage/ReplyTo": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", + "emailMessage/Importance": "High" + }, + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", + "operationId": "SharedMailboxSendEmailV2", + "connectionName": "shared_office365_1" + } } - ] + } } + }, + "expression": { + "and": [ + { + "not": { + "equals": [ + "@body('GetResponseDetails')?['r03afe1c9ab4547a18b4bdbff6418b128']", + "" + ] + } + } + ] + }, + "metadata": { + "operationMetadataId": "414efc57-a3c0-4b35-b64f-93c879d79ac7" + }, + "type": "If" + } + }, + "runAfter": { + "InitializeLinksToAttachmentsAsList": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "a5c29fcb-cfb0-47b5-98db-caba000d824f" + }, + "type": "Scope" + }, + "Catch": { + "actions": { + "FilterForFailedOrTimedOutStatus": { + "metadata": { + "operationMetadataId": "ca1bedd8-7555-4a99-a290-1c22c2e6e229" + }, + "type": "Query", + "inputs": { + "from": "@result('Try')", + "where": "@or(equals(item()?['Status'], 'Failed'), equals(item()?['Status'], 'TimedOut'))" + } + }, + "CreateHtmlTable": { + "runAfter": { + "FilterForFailedOrTimedOutStatus": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "34b6a96f-64c6-43fd-89a3-fe7d5ef245ff" + }, + "type": "Table", + "inputs": { + "from": "@body('FilterForFailedOrTimedOutStatus')", + "format": "HTML", + "columns": [ + { + "header": "ProposalId", + "value": "@triggerBody()?['proposalId']" + }, + { + "header": "ProposalTitle", + "value": "@outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']" + }, + { + "header": "SubmittedBy", + "value": "@outputs('GetResponseDetails')?['body/responder']" + }, + { + "header": "ErrorCode", + "value": "@item()?['code']" + } + ] } }, - "EmailContents": { + "Terminate": { "runAfter": { - "AdaptiveCard": [ + "SendFailureNotification": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "4a75e677-4358-4992-a664-ffe5b41e0922" + "operationMetadataId": "0f41eff7-41db-4eae-8e12-46f64d545e8b" }, - "type": "Compose", - "inputs": "" + "type": "Terminate", + "inputs": { + "runStatus": "Cancelled" + } }, - "SupervisorInformationEmail": { + "SendFailureNotification": { "runAfter": { - "EmailContents": [ + "CreateHtmlTable": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "ca5e164f-cb5e-4a62-9467-189c5311ca33" + "operationMetadataId": "e7c370de-36de-45b2-ae99-b7d0e7013242" }, "type": "OpenApiConnection", "inputs": { "parameters": { - "emailMessage/MailboxAddress": "@parameters('Outlook From Address (uzhbf_thesisplatform_outlook_from_address_env_var)')", - "emailMessage/To": "@items('EmailToSupervisors')", - "emailMessage/Subject": "DBF Theses - New Proposal for Review (@{outputs('GetResponseDetails')?['body/r7240915136fb41e8b884a045d08f39ce']})", - "emailMessage/Body": "@outputs('EmailContents')", - "emailMessage/Bcc": "@parameters('Outlook Management Inbox (uzhbf_thesisplatform_thesis_inbox_env_var)')", - "emailMessage/Attachments": [ - { - "Name": "@variables('PersonalCVPDFName')", - "ContentBytes": "@body('GetFileUploadCVPDF')" - }, - { - "Name": "@variables('TranscriptPDFName')", - "ContentBytes": "@body('GetFileUploadTranscriptPDF')" - }, - { - "Name": "@variables('ProposalPDFName')", - "ContentBytes": "@body('GetFileUploadProposalPDF')" - } - ], - "emailMessage/ReplyTo": "@outputs('GetResponseDetails')?['body/responder']", - "emailMessage/Importance": "High" + "request/to": "@{parameters('Email Failure Notification (uzhbf_thesisplatform_email_failure_env_var)')};", + "request/subject": "(@{parameters('Environment (uzhbf_thesisplatform_environment_env_var)')}) Failure in UZH BF Thesis Platform - Thesis Proposal Submission", + "request/text": "

    @{body('CreateHtmlTable')}

    " }, "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365", - "operationId": "SharedMailboxSendEmailV2", - "connectionName": "shared_office365_1" + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sendmail", + "operationId": "SendEmailV3", + "connectionName": "shared_sendmail-2" } } } }, "runAfter": { - "CreateProposalAttachment": [ - "Succeeded" - ], - "CreateCVAttachment": [ - "Succeeded" - ], - "CreateTranscriptAttachment": [ - "Succeeded" + "Try": [ + "Failed", + "TimedOut" ] }, "metadata": { - "operationMetadataId": "59fc0f49-7782-4696-b7cb-f1b30f3402ea" + "operationMetadataId": "054f28a3-080c-4f8a-9529-1183121f12f9" }, - "type": "Foreach" + "type": "Scope" }, - "ExtractPersonalCVPDFName": { + "InitializeLinksToAttachments": { "runAfter": { - "ParsePersonalCVPDF": [ + "InitializeTranscriptPdfName": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "1e85d048-5c8e-4877-b685-55bed992f515" + "operationMetadataId": "11aa68ed-fbd5-48a8-b078-5683c4037ea9" }, "type": "InitializeVariable", "inputs": { "variables": [ { - "name": "PersonalCVPDFName", - "type": "string", - "value": "@{first(body('ParsePersonalCVPDF'))?['name']}" + "name": "links", + "type": "array" } ] } }, - "GetFileUploadCVPDF": { - "runAfter": { - "ExtractPersonalCVPDFName": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "907d739d-ea78-479a-9b6a-03d3b381ed25" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "path": "/Apps/Microsoft Forms/Submit Thesis Proposal/Personal CV (PDF)/@{variables('PersonalCVPDFName')}", - "inferContentType": true - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", - "operationId": "GetFileContentByPath", - "connectionName": "shared_onedriveforbusiness_1" - } - } - }, - "PersistCVPDF": { - "runAfter": { - "GetFileUploadCVPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "5addcee8-04fe-48e5-aa5b-e73aa3bf0b27" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "folderPath": "/@{parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')}/Proposals/@{outputs('GetResponseDetails')?['body/responder']}", - "name": "@{variables('ProposalId')}_cv_@{variables('PersonalCVPDFName')}", - "body": "@body('GetFileUploadCVPDF')" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateFile", - "connectionName": "shared_sharepointonline_1" - } - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" - } - } - }, - "ShareLinkCVPDF": { - "runAfter": { - "PersistCVPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "f98fbe3a-7eae-42a9-9aec-2a4950006e98" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "dataset": "@parameters('Sharepoint Site (uzhbf_thesisplatform_sharepoint_site_env_var)')", - "table": "@parameters('Proposals Document Library Name (uzhbf_thesisplatform_proposals_document_library_name_env_var)')", - "id": "@outputs('PersistCVPDF')?['body/ItemId']", - "permission/type": "view", - "permission/scope": "organization" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", - "operationId": "CreateSharingLink", - "connectionName": "shared_sharepointonline_1" - } - } - }, - "CreateCVAttachment": { - "runAfter": { - "ShareLinkCVPDF": [ - "Succeeded" - ] - }, - "metadata": { - "operationMetadataId": "edca8bce-6316-4cee-b027-83094e1b5a19" - }, - "type": "OpenApiConnection", - "inputs": { - "parameters": { - "server": "default", - "database": "default", - "table": "[main].[applicationattachment]", - "item/createdAt": "@outputs('GetResponseDetails')?['body/submitDate']", - "item/href": "@outputs('ShareLinkCVPDF')?['body/link/webUrl']", - "item/id": "@{guid()}", - "item/name": "CV", - "item/proposalApplicationId": "@outputs('PersistApplicationToDB')?['body/id']", - "item/type": "@outputs('PersistCVPDF')?['body/MediaType']", - "item/updatedAt": "@outputs('GetResponseDetails')?['body/submitDate']" - }, - "host": { - "apiId": "/providers/Microsoft.PowerApps/apis/shared_azuremysql", - "operationId": "PostItem", - "connectionName": "shared_azuremysql" - } - } - }, - "ExtractTranscriptPDFName": { + "InitializeLinksToAttachmentsAsList": { "runAfter": { - "ParseTranscriptPDF": [ + "InitializeLinksToAttachments": [ "Succeeded" ] }, "metadata": { - "operationMetadataId": "98af1222-c483-473f-a5a5-1c90bd4de1e9" + "operationMetadataId": "ad967f30-6249-479c-84d4-670e62425731" }, "type": "InitializeVariable", "inputs": { "variables": [ { - "name": "TranscriptPDFName", + "name": "linksAsList", "type": "string", - "value": "@{first(body('ParseTranscriptPDF'))?['name']}" + "value": "