-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
923 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
docker build --pull -t ${{ env.REGISTRY }}/vacdm/vacdm:dev . | ||
docker push ${{ env.REGISTRY }}/vacdm/vacdm:dev |
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,32 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
docker build --pull -t ${{ env.REGISTRY }}/vacdm/vacdm:latest . | ||
docker push ${{ env.REGISTRY }}/vacdm/vacdm:latest |
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
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,47 @@ | ||
import axios from 'axios'; | ||
import config from '../config'; | ||
import dayjs from 'dayjs'; | ||
|
||
export async function getAllBookings() { | ||
try { | ||
const events = await axios.get( | ||
config().eventUrl | ||
); | ||
|
||
const relevantEvents = events.data.data.filter((e) => | ||
dayjs(new Date()) >= dayjs(e.startEvent) && | ||
dayjs(new Date()) <= dayjs(e.endEvent) | ||
); | ||
|
||
const relevantBookings: any[] = []; | ||
|
||
for (let event of relevantEvents) { | ||
const bookings = await axios.get(event.links.bookings); | ||
|
||
for (let booking of bookings.data.data) { | ||
relevantBookings.push(booking); | ||
} | ||
} | ||
|
||
return relevantBookings; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
export async function pilotHasBooking(cid: number): Promise<boolean> { | ||
try { | ||
const bookings = await getAllBookings(); | ||
|
||
return bookings.findIndex((b) => b.user === cid) != -1; | ||
|
||
|
||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
export default { | ||
getAllBookings, | ||
pilotHasBooking | ||
}; |
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
Oops, something went wrong.