-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into feat/excel-image-upload
- Loading branch information
Showing
58 changed files
with
14,458 additions
and
4,856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Deploy Impler to Production | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_api: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/build-api.yml | ||
secrets: inherit | ||
|
||
build_embed: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/build-embed.yml | ||
secrets: inherit | ||
|
||
build_queuemanager: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/build-queuemanager.yml | ||
secrets: inherit | ||
|
||
build_web: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/build-web.yml | ||
secrets: inherit | ||
|
||
build_widget: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/build-widget.yml | ||
secrets: inherit | ||
|
||
tag_images: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/tag-images.yml | ||
secrets: inherit | ||
|
||
publish_npm: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
uses: ./.github/workflows/publish-prod-packages.yml | ||
secrets: inherit | ||
|
||
deploy_with_ssh: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build_api | ||
- build_embed | ||
- build_queuemanager | ||
- build_web | ||
- build_widget | ||
- tag_images | ||
- publish_npm | ||
if: | | ||
always() && | ||
(needs.build_api.result == 'success' && needs.build_embed.result == 'success' && needs.build_queuemanager.result == 'success' && needs.build_web.result == 'success' && needs.build_widget.result == 'success' && needs.tag_images.result == 'success' && needs.publish_npm.result == 'success') | ||
steps: | ||
- name: Set up SSH and Run Docker Compose Up | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_QA }} | ||
- name: Run Docker Compose Up | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME_QA }}@${{ secrets.SSH_HOST_QA }} \ | ||
"cd ${{ secrets.SSH_PATH_QA }} && docker compose up --pull always -d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
name: Deploy Impler to Quality | ||
|
||
on: | ||
push: | ||
branches: | ||
- next | ||
pull_request: | ||
branches: [next] | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build_api: | ||
permissions: | ||
contents: read | ||
packages: write | ||
deployments: write | ||
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/api/') }} | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'impler/api')) }} | ||
uses: ./.github/workflows/build-api.yml | ||
secrets: inherit | ||
|
||
|
@@ -20,7 +21,7 @@ jobs: | |
contents: read | ||
packages: write | ||
deployments: write | ||
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/demo/') }} | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'impler/embed')) }} | ||
uses: ./.github/workflows/build-embed.yml | ||
secrets: inherit | ||
|
||
|
@@ -29,7 +30,7 @@ jobs: | |
contents: read | ||
packages: write | ||
deployments: write | ||
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/queue-manager/') }} | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'impler/queuemanager')) }} | ||
uses: ./.github/workflows/build-queuemanager.yml | ||
secrets: inherit | ||
|
||
|
@@ -38,7 +39,7 @@ jobs: | |
contents: read | ||
packages: write | ||
deployments: write | ||
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/web/') }} | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'impler/web')) }} | ||
uses: ./.github/workflows/build-web.yml | ||
secrets: inherit | ||
|
||
|
@@ -47,7 +48,7 @@ jobs: | |
contents: read | ||
packages: write | ||
deployments: write | ||
if: ${{ github.event_name == 'push' && (github.event.head_commit.modified || github.event.head_commit.added || github.event.head_commit.removed) && contains(toJSON(github.event.head_commit.modified), 'apps/widget/') }} | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'impler/widget')) }} | ||
uses: ./.github/workflows/build-widget.yml | ||
secrets: inherit | ||
|
||
|
@@ -63,11 +64,11 @@ jobs: | |
always() && | ||
(needs.build_api.result == 'success' || needs.build_embed.result == 'success' || needs.build_queuemanager.result == 'success' || needs.build_web.result == 'success' || needs.build_widget.result == 'success') | ||
steps: | ||
- name: Set up SSH and Run Docker Compose Up | ||
- name: Set up SSH and Up the service | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_QA }} | ||
- name: Run Docker Compose Up | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME_QA }}@${{ secrets.SSH_HOST_QA }} \ | ||
"cd ${{ secrets.SSH_PATH_QA }} && docker compose up -d" | ||
"cd ${{ secrets.SSH_PATH_QA }} && sudo docker compose up --pull always -d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/api/src/app/user/usecases/apply-coupon/apply-coupon.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { PaymentAPIService } from '@impler/shared'; | ||
import { BadRequestException, Injectable, InternalServerErrorException } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class ApplyCoupon { | ||
constructor(private paymentApiService: PaymentAPIService) {} | ||
|
||
async execute(couponCode: string, userEmail: string, planCode: string) { | ||
try { | ||
return await this.paymentApiService.checkAppliedCoupon(couponCode, userEmail, planCode); | ||
} catch (error) { | ||
if (error) { | ||
throw new BadRequestException(error); | ||
} else throw new InternalServerErrorException(); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
apps/api/src/app/user/usecases/checkout/checkout.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { PaymentAPIService } from '@impler/shared'; | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class Checkout { | ||
constructor(private paymentApiService: PaymentAPIService) {} | ||
|
||
async execute({ | ||
externalId, | ||
paymentMethodId, | ||
planCode, | ||
couponCode, | ||
}: { | ||
externalId: string; | ||
planCode: string; | ||
paymentMethodId: string; | ||
couponCode?: string; | ||
}) { | ||
return this.paymentApiService.checkout({ | ||
externalId: externalId, | ||
planCode: planCode, | ||
paymentMethodId: paymentMethodId, | ||
couponCode: couponCode, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.