Skip to content

Commit

Permalink
Merge pull request #73 from jamalsoueidan/split-schedule
Browse files Browse the repository at this point in the history
feat(customer): add customer availability, booking, location, product…
  • Loading branch information
jamalsoueidan authored Oct 24, 2023
2 parents 7a33eea + 1d9c5bc commit 6a5a4bd
Show file tree
Hide file tree
Showing 42 changed files with 651 additions and 579 deletions.
48 changes: 32 additions & 16 deletions .github/workflows/deploy-azure-functions-production.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
name: Deploy to Azure Function App (Production)
name: Deploy Node.js project to Azure Function App

on:
push:
branches:
- main

# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
# AZURE_FUNCTIONAPP_PUBLISH_PROFILE
#
# 2. Change these variables for your configuration:

env:
AZURE_FUNCTIONAPP_NAME: "booking-shopify-api" # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: "." # set this to the path to your function app project, defaults to the repository root
NODE_VERSION: "18.x" # set this to the node version to use (e.g. '8.x', '10.x', '12.x')

jobs:
build-and-deploy:
runs-on: ubuntu-latest

environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Checkout GitHub Action"
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci
node-version: ${{ env.NODE_VERSION }}

- name: Build
run: npm run build
- name: "Resolve Project Dependencies Using Npm"
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install
npm run build --if-present
popd
- name: Deploy to Azure Function App
uses: azure/functions-action@v1
- name: "Run Azure Functions Action"
uses: Azure/functions-action@v1
id: fa
with:
app-name: booking-shopify-api
package: .
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCTION_APP_PUBLISH_PROFILE_PRODUCTION }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"prebuild": "npm run clean",
"build": "tsc",
"build": "tsc --project tsconfig.build.json",
"watch": "tsc -w",
"clean": "rimraf dist",
"prestart": "npm run clean && npm run build",
Expand Down
12 changes: 12 additions & 0 deletions src/functions/customer-availability.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "module-alias/register";

import { app } from "@azure/functions";

import { CustomerAvailabilityControllerGet } from "./customer/controllers/availability";

app.http("customerAvailabilityGet", {
methods: ["POST"],
authLevel: "anonymous",
route: "customer/{customerId?}/availability/{locationId?}/get",
handler: CustomerAvailabilityControllerGet,
});
22 changes: 22 additions & 0 deletions src/functions/customer-booking.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import "module-alias/register";

import { app } from "@azure/functions";

import {
CustomerBookingControllerGet,
CustomerBookingControllerList,
} from "./customer/controllers/booking";

app.http("customerBookingGet", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/booking/{orderId?}",
handler: CustomerBookingControllerGet,
});

app.http("customerBookingList", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/bookings",
handler: CustomerBookingControllerList,
});
70 changes: 70 additions & 0 deletions src/functions/customer-location.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import "module-alias/register";

import { app } from "@azure/functions";

import {
CustomerLocationControllerAdd,
CustomerLocationControllerCreate,
CustomerLocationControllerGetAll,
CustomerLocationControllerGetAllOrigins,
CustomerLocationControllerGetOne,
CustomerLocationControllerRemove,
CustomerLocationControllerSetDefault,
CustomerLocationControllerUpdate,
} from "./customer/controllers/location";

app.http("customerLocationGetAllOrigins", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId}/locations/get-all-origins",
handler: CustomerLocationControllerGetAllOrigins,
});

app.http("customerLocationList", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId}/locations",
handler: CustomerLocationControllerGetAll,
});

app.http("customerLocationGet", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId}/location/{locationId}",
handler: CustomerLocationControllerGetOne,
});

app.http("customerLocationUpdate", {
methods: ["PUT"],
authLevel: "anonymous",
route: "customer/{customerId}/location/{locationId?}",
handler: CustomerLocationControllerUpdate,
});

app.http("customerLocationCreate", {
methods: ["POST"],
authLevel: "anonymous",
route: "customer/{customerId}/locations",
handler: CustomerLocationControllerCreate,
});

app.http("customerLocationAdd", {
methods: ["POST"],
authLevel: "anonymous",
route: "customer/{customerId}/location/{locationId}",
handler: CustomerLocationControllerAdd,
});

app.http("customerLocationRemove", {
methods: ["DELETE"],
authLevel: "anonymous",
route: "customer/{customerId}/location/{locationId}",
handler: CustomerLocationControllerRemove,
});

app.http("customerLocationSetDefault", {
methods: ["PUT"],
authLevel: "anonymous",
route: "customer/{customerId}/location/{locationId}/setDefault",
handler: CustomerLocationControllerSetDefault,
});
46 changes: 46 additions & 0 deletions src/functions/customer-product.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import "module-alias/register";
import { CustomerProductsControllerList } from "./customer/controllers/products/list";

import { app } from "@azure/functions";

import {
CustomerProductControllerDestroy,
CustomerProductControllerGet,
CustomerProductControllerUpsert,
} from "./customer/controllers/product";
import { CustomerProductsControllerListIds } from "./customer/controllers/products";

app.http("customerProductsListIds", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/products/ids",
handler: CustomerProductsControllerListIds,
});

app.http("customerProductsList", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/products",
handler: CustomerProductsControllerList,
});

app.http("customerProductUpsert", {
methods: ["PUT"],
authLevel: "anonymous",
route: "customer/{customerId?}/product/{productId?}",
handler: CustomerProductControllerUpsert,
});

app.http("customerProductGet", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/product/{productId?}",
handler: CustomerProductControllerGet,
});

app.http("customerProductDestroy", {
methods: ["DELETE"],
authLevel: "anonymous",
route: "customer/{customerId?}/product/{productId?}",
handler: CustomerProductControllerDestroy,
});
54 changes: 54 additions & 0 deletions src/functions/customer-schedule.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import "module-alias/register";

import { app } from "@azure/functions";

import {
CustomerScheduleControllerCreate,
CustomerScheduleControllerDestroy,
CustomerScheduleControllerGet,
CustomerScheduleControllerList,
CustomerScheduleControllerUpdate,
} from "./customer/controllers/schedule";
import { CustomerScheduleSlotControllerUpdate } from "./customer/controllers/slot";

app.http("customerScheduleDestroy", {
methods: ["DELETE"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedule/{scheduleId?}",
handler: CustomerScheduleControllerDestroy,
});

app.http("customerScheduleCreate", {
methods: ["POST"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedule",
handler: CustomerScheduleControllerCreate,
});

app.http("customerScheduleUpdate", {
methods: ["PUT"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedule/{scheduleId?}",
handler: CustomerScheduleControllerUpdate,
});

app.http("customerScheduleGet", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedule/{scheduleId?}",
handler: CustomerScheduleControllerGet,
});

app.http("customerScheduleList", {
methods: ["GET"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedules",
handler: CustomerScheduleControllerList,
});

app.http("customerScheduleSlotUpdate", {
methods: ["PUT"],
authLevel: "anonymous",
route: "customer/{customerId?}/schedule/{scheduleId?}/slots",
handler: CustomerScheduleSlotControllerUpdate,
});
Loading

0 comments on commit 6a5a4bd

Please sign in to comment.