Compare commits
1 Commits
7d88890c3c
...
111-add-pa
| Author | SHA1 | Date | |
|---|---|---|---|
| db7a5444b3 |
@@ -1,44 +0,0 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app_name:
|
||||
required: true
|
||||
type: string
|
||||
environment_name:
|
||||
required: true
|
||||
type: string
|
||||
version_number:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.environment_name }}
|
||||
steps:
|
||||
- name: Get Secrets from Infisical
|
||||
uses: Infisical/secrets-action@v1.0.16
|
||||
with:
|
||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
||||
env-slug: ${{ inputs.environment_name }}
|
||||
secret-path: /flying
|
||||
|
||||
- name: Install Azure CLI
|
||||
run: |
|
||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||
|
||||
- name: Log in to Azure
|
||||
run: |
|
||||
az login --service-principal --username ${{ env.AZURE_CLIENT_ID }} --password ${{ env.AZURE_CLIENT_SECRET }} --tenant ${{ env.AZURE_TENANT_ID }}
|
||||
|
||||
- name: Update Container App
|
||||
run: |
|
||||
az containerapp update --name ${{ inputs.app_name }}-${{ inputs.environment_name }} --container-name ${{ inputs.app_name }} --resource-group ${{ env.RESOURCE_GROUP }} --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
||||
@@ -1,19 +0,0 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.gitea/workflows/changes.yaml
|
||||
|
||||
build:
|
||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true'}}
|
||||
name: build-and-test
|
||||
needs:
|
||||
- changes
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: test
|
||||
version_number: ${{ github.run_id }}
|
||||
secrets: inherit
|
||||
@@ -1,44 +0,0 @@
|
||||
name: 'Terraform'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment_name:
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
terraform:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
infrastructure
|
||||
|
||||
- name: Get Secrets from Infisical
|
||||
uses: Infisical/secrets-action@v1.0.16
|
||||
with:
|
||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
||||
env-slug: ${{ inputs.environment_name }}
|
||||
secret-path: /flying/terraform
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v4
|
||||
|
||||
- name: Terraform init
|
||||
run: |
|
||||
terraform -chdir=./infrastructure init -reconfigure -backend-config="./backend/${{ inputs.environment_name }}.backend.tfvars" -input=false
|
||||
|
||||
- name: Terraform plan
|
||||
run: |
|
||||
terraform -chdir=./infrastructure plan -no-color -input=false
|
||||
|
||||
# - name: Terraform apply
|
||||
# if: ${{ github.event_name != 'pull_request' }}
|
||||
# run: |
|
||||
# terraform -chdir=./infrastructure apply -no-color -input=false
|
||||
|
||||
@@ -15,22 +15,12 @@ jobs:
|
||||
environment: ${{ inputs.environment_name }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
sparse-checkout: |
|
||||
api
|
||||
client
|
||||
|
||||
- name: Get Secrets from Infisical
|
||||
uses: Infisical/secrets-action@v1.0.16
|
||||
with:
|
||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
||||
env-slug: ${{ inputs.environment_name }}
|
||||
secret-path: /flying
|
||||
|
||||
- name: Install Nest CLI
|
||||
run: |
|
||||
npm install -g @nestjs/cli
|
||||
@@ -38,7 +28,7 @@ jobs:
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
node-version: ${{ vars.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
@@ -54,20 +44,21 @@ jobs:
|
||||
|
||||
- name: Build Client
|
||||
env:
|
||||
VITE_API_URL: ${{ env.VITE_API_URL }}
|
||||
VITE_BASE_URL: ${{ env.VITE_BASE_URL }}
|
||||
VITE_CLIENT_ID: ${{ env.VITE_CLIENT_ID }}
|
||||
VITE_ISSUER_URI: ${{ env.VITE_ISSUER_URI }}
|
||||
VITE_TENANT_ID: ${{ env.VITE_TENANT_ID }}
|
||||
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
||||
VITE_BASE_URL: ${{ vars.VITE_BASE_URL }}
|
||||
VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }}
|
||||
VITE_ISSUER_URI: ${{ vars.VITE_ISSUER_URI }}
|
||||
VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }}
|
||||
run: |
|
||||
printenv
|
||||
npm run build -w client
|
||||
|
||||
- name: Log into Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ env.DOCKERHUB_USERNAME }}
|
||||
password: ${{ env.DOCKERHUB_TOKEN }}
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
@@ -7,9 +7,6 @@ on:
|
||||
client:
|
||||
value: ${{ jobs.changes.outputs.client }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: filter
|
||||
@@ -18,13 +15,7 @@ jobs:
|
||||
api: ${{ steps.filter.outputs.api }}
|
||||
client: ${{ steps.filter.outputs.client }}
|
||||
steps:
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
@@ -33,6 +24,4 @@ jobs:
|
||||
api:
|
||||
- 'api/**'
|
||||
client:
|
||||
- 'client/**'
|
||||
infrastructure:
|
||||
- 'infrastructure/**'
|
||||
- 'client/**'
|
||||
35
.github/workflows/deploy.yaml
vendored
Normal file
35
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app_name:
|
||||
required: true
|
||||
type: string
|
||||
environment_name:
|
||||
required: true
|
||||
type: string
|
||||
version_number:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.environment_name }}
|
||||
steps:
|
||||
- name: Log in to Azure
|
||||
uses: azure/login@v2
|
||||
with:
|
||||
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
||||
|
||||
- name: Azure CLI script
|
||||
uses: azure/cli@v2
|
||||
with:
|
||||
azcliversion: latest
|
||||
inlineScript: |
|
||||
az containerapp update --name ${{ inputs.app_name }}-${{ inputs.environment_name }} --container-name ${{ inputs.app_name }} --resource-group noahspan --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
||||
@@ -6,14 +6,14 @@ on:
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.gitea/workflows/changes.yaml
|
||||
uses: ./.github/workflows/changes.yaml
|
||||
|
||||
build-and-test:
|
||||
build:
|
||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
||||
name: build-and-test
|
||||
name: build
|
||||
needs:
|
||||
- changes
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
uses: ./.github/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: test
|
||||
version_number: ${{ github.run_id }}
|
||||
@@ -23,8 +23,8 @@ jobs:
|
||||
name: deploy
|
||||
needs:
|
||||
- changes
|
||||
- build-and-test
|
||||
uses: ./.gitea/workflows/deploy.yaml
|
||||
- build
|
||||
uses: ./.github/workflows/deploy.yaml
|
||||
with:
|
||||
app_name: flying
|
||||
environment_name: test
|
||||
19
.github/workflows/pull_request.yaml
vendored
Normal file
19
.github/workflows/pull_request.yaml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.github/workflows/changes.yaml
|
||||
|
||||
build:
|
||||
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.client == 'true'}}
|
||||
name: build
|
||||
needs:
|
||||
- changes
|
||||
uses: ./.github/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: pull_request
|
||||
version_number: ${{ github.run_id }}
|
||||
secrets: inherit
|
||||
@@ -5,9 +5,9 @@ on:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
name: build-and-test
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
build:
|
||||
name: build
|
||||
uses: ./.github/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: prod
|
||||
version_number: ${{ github.ref_name }}
|
||||
@@ -16,8 +16,8 @@ jobs:
|
||||
deploy:
|
||||
name: deploy
|
||||
needs:
|
||||
- build-and-test
|
||||
uses: ./.gitea/workflows/deploy.yaml
|
||||
- build
|
||||
uses: ./.github/workflows/deploy.yaml
|
||||
with:
|
||||
app_name: flying
|
||||
environment_name: prod
|
||||
24
README.md
24
README.md
@@ -1,23 +1,3 @@
|
||||
# Flying
|
||||
# Flying (React and NestJS)
|
||||
|
||||
A web app for tracking pilot flight hours and sharing flight tracks.
|
||||
|
||||
## Built With
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
### Installation
|
||||
|
||||
## Usage
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Expense tracking for plane rental, instructor fees, and fuel rates
|
||||
- [ ] Export logbook to CSV
|
||||
- [ ]
|
||||
|
||||
## License
|
||||
|
||||
## Contact
|
||||
A pilot logbook app
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Flying API
|
||||
|
||||
An API for the Flying app.
|
||||
...
|
||||
An API for the Flying app.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "api",
|
||||
"version": "2.1.5",
|
||||
"version": "2.0.2",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
|
||||
5
api/src/interfaces/customJwtPayload.interface.ts
Normal file
5
api/src/interfaces/customJwtPayload.interface.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { JwtPayload } from "jwt-decode";
|
||||
|
||||
export interface CustomJwtPayload extends JwtPayload {
|
||||
permissions: string[];
|
||||
}
|
||||
@@ -14,7 +14,6 @@ describe('LogController', () => {
|
||||
delete: jest.fn(),
|
||||
find: jest.fn(),
|
||||
findLogsWithCount: jest.fn(),
|
||||
findLogsWithTracks: jest.fn(),
|
||||
update: jest.fn()
|
||||
}
|
||||
|
||||
@@ -39,41 +38,18 @@ describe('LogController', () => {
|
||||
})
|
||||
|
||||
it('find => should find a log by id', async () => {
|
||||
const id: string = '95834f84-0a02-44d3-884e-a20237adeca0';
|
||||
const log = {
|
||||
id: '95834f84-0a02-44d3-884e-a20237adeca0',
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: []
|
||||
|
||||
} as LogEntity
|
||||
|
||||
jest.spyOn(mockLogService, 'find').mockReturnValue(log);
|
||||
|
||||
const result = await controller.find(log.id);
|
||||
const result = await controller.find(id);
|
||||
|
||||
expect(result).toEqual(log);
|
||||
expect(mockLogService.find).toHaveBeenCalled();
|
||||
expect(mockLogService.find).toHaveBeenCalledWith(log.id);
|
||||
expect(mockLogService.find).toHaveBeenCalledWith(id);
|
||||
})
|
||||
|
||||
it('find => should fail to find a log by id', async () => {
|
||||
@@ -93,60 +69,18 @@ describe('LogController', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('findLogsWithCount => should find logs with count', async () => {
|
||||
it('findLogsWithCount => should find all logs', async () => {
|
||||
const id: string = '95834f84-0a02-44d3-884e-a20237adeca0';
|
||||
const log = {
|
||||
id: '95834f84-0a02-44d3-884e-a20237adeca0',
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: [
|
||||
{
|
||||
"id": "4645ce0c-6fd7-432c-8089-777a7139cf7e",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KANE_KONA_20250628.kml",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "5ce26898-a18b-46f4-b989-3fb7acdace08",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KONA_KANE_20250628.kml",
|
||||
"order": 2
|
||||
}
|
||||
]
|
||||
|
||||
} as LogEntity;
|
||||
const logs = [log]
|
||||
const count = 1
|
||||
const morePages = false
|
||||
|
||||
jest.spyOn(mockLogService, 'findLogsWithCount').mockReturnValue({
|
||||
entities: logs,
|
||||
total: count,
|
||||
hasNextPage: morePages
|
||||
});
|
||||
jest.spyOn(mockLogService, 'findLogsWithCount').mockReturnValue(logs);
|
||||
|
||||
const {entities, total, hasNextPage} = await controller.findLogsWithCount();
|
||||
const result = await controller.findLogsWithCount();
|
||||
|
||||
expect(entities).toEqual(logs);
|
||||
expect(total).toEqual(count);
|
||||
expect(hasNextPage).toEqual(morePages)
|
||||
expect(result).toEqual(logs);
|
||||
expect(mockLogService.findLogsWithCount).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
@@ -164,130 +98,13 @@ describe('LogController', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('findLogsWithTracks => should find logs with tracks', async () => {
|
||||
const log = {
|
||||
id: '95834f84-0a02-44d3-884e-a20237adeca0',
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: [
|
||||
{
|
||||
"id": "4645ce0c-6fd7-432c-8089-777a7139cf7e",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KANE_KONA_20250628.kml",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "5ce26898-a18b-46f4-b989-3fb7acdace08",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KONA_KANE_20250628.kml",
|
||||
"order": 2
|
||||
}
|
||||
]
|
||||
} as LogEntity;
|
||||
const logs = [log]
|
||||
const count = 1
|
||||
const morePages = false
|
||||
|
||||
jest.spyOn(mockLogService, 'findLogsWithTracks').mockReturnValue({
|
||||
entities: logs,
|
||||
total: count,
|
||||
hasNextPage: morePages
|
||||
});
|
||||
|
||||
const {entities, total, hasNextPage} = await controller.findLogsWithTracks();
|
||||
|
||||
expect(entities).toEqual(logs);
|
||||
expect(total).toEqual(count);
|
||||
expect(hasNextPage).toEqual(morePages)
|
||||
expect(mockLogService.findLogsWithTracks).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
it('findLogsWithCount => should fail to find logs with tracks', async () => {
|
||||
jest.spyOn(mockLogService, 'findLogsWithTracks').mockRejectedValue(new Error('Logs not found'))
|
||||
|
||||
try {
|
||||
await controller.findLogsWithTracks();
|
||||
|
||||
fail('findLogsWithTracks did not throw error');
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
expect(mockLogService.findLogsWithTracks).toHaveBeenCalled();
|
||||
expect(mockLogService.findLogsWithTracks).rejects.toThrow('Logs not found')
|
||||
}
|
||||
})
|
||||
|
||||
it('create => should create a new log', async () => {
|
||||
const logDto = {
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test'
|
||||
|
||||
} as LogDto;
|
||||
|
||||
const log = {
|
||||
id: '95834f84-0a02-44d3-884e-a20237adeca0',
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: []
|
||||
|
||||
} as LogEntity;
|
||||
|
||||
jest.spyOn(mockLogService, 'create').mockReturnValue(log);
|
||||
@@ -299,31 +116,9 @@ describe('LogController', () => {
|
||||
expect(result).toEqual(log);
|
||||
})
|
||||
|
||||
it('create => should fail to create a new log', async () => {
|
||||
it('create => should failt to create a new log', async () => {
|
||||
const logDto = {
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test'
|
||||
|
||||
} as LogDto;
|
||||
|
||||
jest.spyOn(mockLogService, 'create').mockRejectedValue(new Error('Log failed to create'))
|
||||
@@ -343,29 +138,7 @@ describe('LogController', () => {
|
||||
it('update => should update an existing log', async () => {
|
||||
const id: string = '95834f84-0a02-44d3-884e-a20237adeca0';
|
||||
const logDto = {
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test'
|
||||
|
||||
} as LogDto
|
||||
|
||||
jest.spyOn(mockLogService, 'update').mockReturnValue(logDto);
|
||||
@@ -380,29 +153,7 @@ describe('LogController', () => {
|
||||
it('update => should fail to update an exising log', async () => {
|
||||
const id: string = '95834f84-0a02-44d3-884e-a20237adeca0';
|
||||
const logDto = {
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test'
|
||||
|
||||
} as LogDto;
|
||||
|
||||
jest.spyOn(mockLogService, 'update').mockRejectedValue(new Error('Log failed to update'))
|
||||
|
||||
@@ -20,7 +20,6 @@ import { LogInterceptor } from './log.interceptor';
|
||||
import { FileService } from '../file/file.service';
|
||||
import { DeleteResult, InsertResult, UpdateResult } from 'typeorm';
|
||||
import { Reflector } from '@nestjs/core';
|
||||
import { Logs } from './logs.interface';
|
||||
|
||||
const reflector = new Reflector();
|
||||
|
||||
@@ -32,30 +31,7 @@ export class LogController {
|
||||
private readonly logService: LogService
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@Public()
|
||||
async findLogsWithCount(@Query('skip') skip?, @Query('take') take?: number,): Promise<Logs> {
|
||||
try {
|
||||
return await this.logService.findLogsWithCount(skip, take)
|
||||
} catch (error) {
|
||||
const customError = error as CustomError;
|
||||
|
||||
throw new HttpException(customError.message, customError.statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
@Get('flights')
|
||||
@Public()
|
||||
async findLogsWithTracks(@Query('skip') skip?, @Query('take') take?: number,): Promise<Logs> {
|
||||
try {
|
||||
return await this.logService.findLogsWithTracks(skip, take)
|
||||
} catch (error) {
|
||||
const customError = error as CustomError;
|
||||
|
||||
throw new HttpException(customError.message, customError.statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Get(':id')
|
||||
@Public()
|
||||
async find(
|
||||
@@ -69,6 +45,19 @@ export class LogController {
|
||||
throw new HttpException(customError.message, customError.statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Get()
|
||||
@Public()
|
||||
async findLogsWithCount(@Query('skip') skip?, @Query('take') take?: number,): Promise<{ entities: LogEntity[], total: number, hasNextPage: boolean }> {
|
||||
try {
|
||||
return await this.logService.findLogsWithCount(skip, take)
|
||||
} catch (error) {
|
||||
const customError = error as CustomError;
|
||||
|
||||
throw new HttpException(customError.message, customError.statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -15,21 +15,23 @@ export class LogInterceptor implements NestInterceptor {
|
||||
]);
|
||||
|
||||
return handler.handle().pipe(
|
||||
map((data: any) => {
|
||||
map((data: { entities: LogEntity[], total: number, hasNextPage: boolean }) => {
|
||||
const req = context.switchToHttp().getRequest();
|
||||
const limitData = (log: LogEntity) => {
|
||||
return {
|
||||
id: log.id,
|
||||
pilot: {
|
||||
name: log.pilot.name
|
||||
},
|
||||
date: log.date,
|
||||
aircraftMakeModel: log.aircraftMakeModel,
|
||||
routeFrom: log.routeFrom,
|
||||
routeTo: log.routeTo,
|
||||
durationOfFlight: log.durationOfFlight,
|
||||
tracks: log.tracks,
|
||||
};
|
||||
const limitData = (entities: LogEntity[]) => {
|
||||
return entities.map((log: LogEntity) => {
|
||||
return {
|
||||
id: log.id,
|
||||
pilot: {
|
||||
name: log.pilot.name
|
||||
},
|
||||
date: log.date,
|
||||
aircraftMakeModel: log.aircraftMakeModel,
|
||||
routeFrom: log.routeFrom,
|
||||
routeTo: log.routeTo,
|
||||
durationOfFlight: log.durationOfFlight,
|
||||
tracks: log.tracks,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (req.headers.authorization) {
|
||||
@@ -39,38 +41,25 @@ export class LogInterceptor implements NestInterceptor {
|
||||
const rolesKeyName = Object.keys(jwtPayload).find((key) => key.includes('roles'));
|
||||
|
||||
if (jwtPayload[rolesKeyName].includes('Flying.Read')) {
|
||||
if (data.entities) {
|
||||
const logs = data.entities.map((entity) => limitData(entity));
|
||||
const logs = limitData(data.entities);
|
||||
|
||||
return {
|
||||
entities: logs,
|
||||
total: data.total,
|
||||
hasNextPage: data.hasNextPage
|
||||
};
|
||||
} else {
|
||||
const log = limitData(data);
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
return {
|
||||
entities: logs,
|
||||
total: data.total,
|
||||
hasNextPage: data.hasNextPage
|
||||
};
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
} else if (!req.headers.authorization && isPublic) {
|
||||
if (data.entities) {
|
||||
const publicData = data.entities.map((entity) => limitData(entity))
|
||||
const logs = publicData.slice(0, 5)
|
||||
const publicData = limitData(data.entities)
|
||||
const logs = publicData.slice(0, 5)
|
||||
|
||||
return {
|
||||
entities: logs,
|
||||
total: logs.length,
|
||||
hasNextPage: false
|
||||
};
|
||||
} else {
|
||||
const publicData = limitData(data);
|
||||
|
||||
return publicData
|
||||
}
|
||||
return {
|
||||
entities: logs,
|
||||
total: data.total,
|
||||
hasNextPage: data.hasNextPage
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -15,17 +15,7 @@ describe('LogService', () => {
|
||||
deleteFolder: jest.fn()
|
||||
}
|
||||
|
||||
const mockQueryBuilder = {
|
||||
createQueryBuilder: jest.fn().mockReturnThis(),
|
||||
innerJoinAndSelect: jest.fn().mockReturnThis(),
|
||||
orderBy: jest.fn().mockReturnThis(),
|
||||
skip: jest.fn().mockReturnThis(),
|
||||
take: jest.fn().mockReturnThis(),
|
||||
getManyAndCount: jest.fn()
|
||||
}
|
||||
|
||||
const mockLogRepository = {
|
||||
createQueryBuilder: jest.fn().mockReturnValue(mockQueryBuilder),
|
||||
delete: jest.fn(),
|
||||
findAndCount: jest.fn(),
|
||||
findOne: jest.fn(),
|
||||
@@ -69,7 +59,7 @@ describe('LogService', () => {
|
||||
expect(service).toBeDefined();
|
||||
})
|
||||
|
||||
it('create => should create a log entry', async () => {
|
||||
it('create => shoule create a log entry', async () => {
|
||||
const logDto = {
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
@@ -217,84 +207,20 @@ describe('LogService', () => {
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: [
|
||||
{
|
||||
"id": "4645ce0c-6fd7-432c-8089-777a7139cf7e",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KANE_KONA_20250628.kml",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "5ce26898-a18b-46f4-b989-3fb7acdace08",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KONA_KANE_20250628.kml",
|
||||
"order": 2
|
||||
}
|
||||
]
|
||||
tracks: []
|
||||
} as LogEntity;
|
||||
const logs = [log];
|
||||
const count = 1
|
||||
const morePages = false
|
||||
|
||||
jest.spyOn(mockQueryBuilder, 'getManyAndCount').mockReturnValue([logs, count, morePages]);
|
||||
jest.spyOn(mockLogRepository, 'findAndCount').mockReturnValue([logs, count, morePages]);
|
||||
|
||||
const {entities, total, hasNextPage} = await service.findLogsWithCount();
|
||||
|
||||
expect(entities).toEqual(logs);
|
||||
expect(count).toEqual(total);
|
||||
expect(hasNextPage).toEqual(morePages);
|
||||
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
it('findLogsWithTracks => should find log entries with tracks', async () => {
|
||||
const log = {
|
||||
id: 'd685f1ca-28e0-40b9-8713-74467db12965',
|
||||
pilotId: '7c4bae6b-9ec4-469e-8e16-fcbf0b940936',
|
||||
date: new Date('2026-02-21'),
|
||||
aircraftMakeModel: 'Cessna 172M',
|
||||
aircraftIdentity: 'N12345',
|
||||
routeFrom: 'KMSP',
|
||||
routeTo: 'KMSP',
|
||||
durationOfFlight: 1,
|
||||
singleEngineLand: 1,
|
||||
simulatorAtd: null,
|
||||
landingsDay: 1,
|
||||
landingsNight: null,
|
||||
groundTrainingReceived: null,
|
||||
flightTrainingReceived: null,
|
||||
crossCountry: 1,
|
||||
night: null,
|
||||
solo: 1,
|
||||
pilotInCommand: 1,
|
||||
instrumentActual: null,
|
||||
instrumentSimulated: null,
|
||||
instrumentApproaches: null,
|
||||
instrumentHolds: null,
|
||||
instrumentNavTrack: null,
|
||||
notes: 'This is a test',
|
||||
tracks: [
|
||||
{
|
||||
"id": "4645ce0c-6fd7-432c-8089-777a7139cf7e",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KANE_KONA_20250628.kml",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "5ce26898-a18b-46f4-b989-3fb7acdace08",
|
||||
"url": "http://127.0.0.1:10000/devstoreaccount1/tracks/0e7a641a-0264-47f0-88bf-7c296c842d8b/FlightAware_N70392_KONA_KANE_20250628.kml",
|
||||
"order": 2
|
||||
}
|
||||
]
|
||||
} as LogEntity;
|
||||
const logs = [log];
|
||||
const count = 1
|
||||
const morePages = false
|
||||
|
||||
jest.spyOn(mockQueryBuilder, 'getManyAndCount').mockResolvedValue([logs, count, morePages])
|
||||
|
||||
const {entities, total, hasNextPage} = await service.findLogsWithTracks();
|
||||
|
||||
expect(entities).toEqual(logs);
|
||||
expect(count).toEqual(total);
|
||||
expect(hasNextPage).toEqual(morePages);
|
||||
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
it('update => should update a log entry', async () => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { PilotService } from '../pilot/pilot.service';
|
||||
import { PilotEntity } from '../pilot/pilot.entity';
|
||||
import { CustomError } from '../error/customError';
|
||||
import { FileService } from '../file/file.service';
|
||||
import { Logs } from './logs.interface';
|
||||
|
||||
@Injectable()
|
||||
export class LogService {
|
||||
@@ -18,46 +17,20 @@ export class LogService {
|
||||
) {}
|
||||
|
||||
async find(id: string): Promise<LogEntity> {
|
||||
return await this.logRepository.findOne({
|
||||
const logEntity: LogEntity = await this.logRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ['pilot', 'tracks']
|
||||
});
|
||||
|
||||
return logEntity;
|
||||
}
|
||||
|
||||
async findLogsWithCount(skip?: number, take?: number): Promise<Logs> {
|
||||
// const [entities, total] = await this.logRepository.findAndCount({
|
||||
// take,
|
||||
// skip,
|
||||
// order: {
|
||||
// date: 'DESC'
|
||||
// },
|
||||
// relations: ['pilot', 'tracks']
|
||||
// })
|
||||
|
||||
const [entities, total] = await this.logRepository
|
||||
.createQueryBuilder('logs')
|
||||
.innerJoinAndSelect('logs.pilot', 'pilot')
|
||||
.orderBy('logs.date', 'DESC')
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.getManyAndCount()
|
||||
|
||||
return {
|
||||
entities,
|
||||
total,
|
||||
hasNextPage: skip + take < total
|
||||
}
|
||||
}
|
||||
|
||||
async findLogsWithTracks(skip?: number, take?: number): Promise<Logs> {
|
||||
const [entities, total] = await this.logRepository
|
||||
.createQueryBuilder('logs')
|
||||
.innerJoinAndSelect('logs.tracks', 'track')
|
||||
.innerJoinAndSelect('logs.pilot', 'pilot')
|
||||
.orderBy('logs.date', 'DESC')
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.getManyAndCount();
|
||||
async findLogsWithCount(skip?: number, take?: number): Promise<{entities: LogEntity[], total: number, hasNextPage: boolean}> {
|
||||
const [entities, total] = await this.logRepository.findAndCount({
|
||||
take,
|
||||
skip,
|
||||
relations: ['pilot', 'tracks']
|
||||
})
|
||||
|
||||
return {
|
||||
entities,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { LogEntity } from "src/log/log.entity";
|
||||
|
||||
export interface Logs {
|
||||
entities: LogEntity[],
|
||||
total: number,
|
||||
hasNextPage: boolean
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import { LogService } from "../log/log.service";
|
||||
import { LogEntity } from "../log/log.entity";
|
||||
import { CustomError } from "../error/customError";
|
||||
import { FileService } from "../file/file.service";
|
||||
import { Logs } from "src/log/logs.interface";
|
||||
|
||||
@Injectable()
|
||||
export class TrackService {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
...
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "client",
|
||||
"private": true,
|
||||
"version": "2.1.5",
|
||||
"version": "2.0.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -5,68 +5,39 @@ import { LogbookEntry } from "../logbook/LogbookEntry.interface";
|
||||
import { initialState, reducer } from "./reducer";
|
||||
import { useOidc } from "../../auth/oidcConfig";
|
||||
import Alert from "../alert/Alert";
|
||||
import { AxiosError, AxiosResponse } from "axios";
|
||||
import httpClient from "../../httpClient/httpClient";
|
||||
import { useBreakpoints } from "../../hooks/useBreakpoints/UseBreakpoints";
|
||||
import { ScreenSize } from "../../enums/screenSize";
|
||||
|
||||
const Flights = () => {
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
const { logs, logsLoading } = useLogs();
|
||||
const { isUserLoggedIn } = useOidc();
|
||||
const { screenSize } = useBreakpoints();
|
||||
|
||||
const getFlights = async (pageIndex: number, pageSize: number) => {
|
||||
try {
|
||||
const response: AxiosResponse = await httpClient.get(`api/logs/flights`, {
|
||||
params: {
|
||||
skip: pageIndex,
|
||||
take: pageSize
|
||||
}
|
||||
});
|
||||
const flights: LogbookEntry[] = response.data.entities;
|
||||
const hasMore: boolean = response.data.hasNextPage;
|
||||
const total: number = response.data.total;
|
||||
|
||||
if (flights.length > 0) {
|
||||
const newFlights: LogbookEntry[] = [...state.flights, ...flights]
|
||||
const newPageIndex: number = state.pageIndex + flights.length;
|
||||
|
||||
dispatch({ type: 'SET_FLIGHTS', payload: { flights: newFlights, hasMoreFlights: hasMore, pageIndex: newPageIndex, totalFlights: total }})
|
||||
|
||||
if (!isUserLoggedIn && flights.length >= 5) {
|
||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of flights displayed. Sign in to view all flights.'}})
|
||||
} else {
|
||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
||||
}
|
||||
} else {
|
||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No flights found' }})
|
||||
}
|
||||
} catch (error) {
|
||||
const axiosError = error as AxiosError;
|
||||
|
||||
dispatch({
|
||||
type: 'SET_ALERT',
|
||||
payload: { severity: 'error', message: `Loading of flights failed with the following message: ${axiosError.message}`}
|
||||
});
|
||||
} finally {
|
||||
dispatch({ type: 'SET_IS_LOADING', payload: false })
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
getFlights(state.pageIndex, state.pageSize)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getFlights(state.pageIndex, state.pageSize);
|
||||
}, [])
|
||||
|
||||
|
||||
const flights: LogbookEntry[] | undefined = logs?.filter((log: LogbookEntry) => {
|
||||
if (log.tracks && log.tracks.length > 0) {
|
||||
return log;
|
||||
}
|
||||
})
|
||||
|
||||
if (flights && flights.length > 0) {
|
||||
dispatch({ type: 'SET_FLIGHTS', payload: flights})
|
||||
|
||||
if (!isUserLoggedIn && flights.length >= 5) {
|
||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of flights displayed. Sign in to view all flights.'}})
|
||||
} else {
|
||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
||||
}
|
||||
} else {
|
||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No flights found' }})
|
||||
}
|
||||
}, [logs])
|
||||
|
||||
return (
|
||||
<div className={`max-w-screen-lg mx-auto ${screenSize === ScreenSize.SM || screenSize === ScreenSize.MD? 'mr-4 ml-4' : ''}`}>
|
||||
<div className='max-w-screen-lg mx-auto'>
|
||||
<div className='prose mt-5 mb-5'>
|
||||
<h1>Flights</h1>
|
||||
</div>
|
||||
{!state.isLoading && state.alert && (
|
||||
{!logsLoading && state.alert && (
|
||||
<div>
|
||||
<Alert
|
||||
className='mb-5'
|
||||
@@ -79,21 +50,14 @@ const Flights = () => {
|
||||
</Alert>
|
||||
</div>
|
||||
)}
|
||||
{!state.isLoading &&
|
||||
{!logsLoading &&
|
||||
<div>
|
||||
<div>
|
||||
<LogbookCard logs={state.flights} mode='flights' />
|
||||
</div>
|
||||
{state.hasMoreFlights &&
|
||||
<div className='flex items-center justify-center mb-5'>
|
||||
<button className='btn btn-link' onClick={loadMore}>Load more</button>
|
||||
</div>
|
||||
}
|
||||
<LogbookCard logs={state.flights} mode='flights' />
|
||||
</div>
|
||||
}
|
||||
{state.isLoading && [...Array(5)].map((_element, index) => {
|
||||
{logsLoading && [...Array(5)].map((_element, index) => {
|
||||
return (
|
||||
<div className='card bg-base-100 border border-base-300 p-2 mb-5'>
|
||||
<div className='card bg-base-100 border border-base-300 p-2 mb-7'>
|
||||
<div className='card-body' key={index}>
|
||||
<div className='skeleton h-10 w-[150px]' />
|
||||
<div className='skeleton h-[350px]' />
|
||||
|
||||
@@ -5,8 +5,4 @@ export interface FlightsState {
|
||||
alert: Alert | undefined;
|
||||
flights: LogbookEntry[];
|
||||
isLoading: boolean;
|
||||
hasMoreFlights: boolean;
|
||||
pageIndex: number;
|
||||
pageSize: number
|
||||
totalFlights: number;
|
||||
}
|
||||
@@ -5,17 +5,13 @@ import { FlightsState } from "./FlightsState.interface";
|
||||
|
||||
type Action =
|
||||
| { type: 'SET_ALERT'; payload: Alert | undefined }
|
||||
| { type: 'SET_FLIGHTS'; payload: { flights: LogbookEntry[], hasMoreFlights: boolean, pageIndex: number, totalFlights: number } }
|
||||
| { type: 'SET_FLIGHTS'; payload: LogbookEntry[] }
|
||||
| { type: 'SET_IS_LOADING'; payload: boolean }
|
||||
|
||||
export const initialState: FlightsState = {
|
||||
alert: undefined,
|
||||
flights: [],
|
||||
isLoading: true,
|
||||
hasMoreFlights: true,
|
||||
pageIndex: 0,
|
||||
pageSize: 5,
|
||||
totalFlights: 0
|
||||
isLoading: true
|
||||
}
|
||||
|
||||
export const reducer = (
|
||||
@@ -32,10 +28,7 @@ export const reducer = (
|
||||
case 'SET_FLIGHTS': {
|
||||
return {
|
||||
...state,
|
||||
flights: action.payload.flights,
|
||||
hasMoreFlights: action.payload.hasMoreFlights,
|
||||
pageIndex: action.payload.pageIndex,
|
||||
totalFlights: action.payload.totalFlights
|
||||
flights: action.payload
|
||||
}
|
||||
}
|
||||
case 'SET_IS_LOADING': {
|
||||
|
||||
@@ -17,11 +17,6 @@ import { CellContext, ColumnDef, flexRender, getCoreRowModel, HeaderContext, Pag
|
||||
import { useLogbookContext } from '../../hooks/logbookContext/UseLogbookContext';
|
||||
import LogbookDrawer from '../logbookDrawer/LogbookDrawer';
|
||||
import Alert from '../alert/Alert';
|
||||
import TrackMap from '../trackMap/TrackMap';
|
||||
|
||||
interface ActionsProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const Logbook: React.FC<unknown> = () => {
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
@@ -30,22 +25,6 @@ const Logbook: React.FC<unknown> = () => {
|
||||
const { isUserLoggedIn } = useOidc();
|
||||
const { userRole } = useUserRole();
|
||||
const { screenSize } = useBreakpoints();
|
||||
const Actions = ({ id }: ActionsProps) => {
|
||||
return (
|
||||
<div className='dropdown dropdown-end'>
|
||||
<div tabIndex={0} role='button' className='btn btn-ghost p-0'><FontAwesomeIcon icon={faEllipsisVertical} /></div>
|
||||
<ul tabIndex={-1} className="dropdown-content menu bg-base-100 rounded-box w-52 p-2 shadow-sm border border-base-300 !z-[100]">
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onOpenCloseDrawer(FormMode.EDIT, id)}><FontAwesomeIcon icon={faPen} />Edit</a></li>
|
||||
}
|
||||
<li><a onClick={() => onOpenCloseDrawer(FormMode.VIEW, id)}><FontAwesomeIcon icon={faEye} />View</a></li>
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onDeleteLog(id)}><FontAwesomeIcon icon={faTrash} />Delete</a></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const columnTotal = (info: HeaderContext<LogbookEntry, unknown>): number => {
|
||||
const values: number[] = info.table.getPaginationRowModel().rows.map((row: any) => Number(row.getValue(info.column.id))).filter((value: any) => !Number.isNaN(value));
|
||||
let total: number = 0;
|
||||
@@ -137,7 +116,18 @@ const Logbook: React.FC<unknown> = () => {
|
||||
},
|
||||
cell: (info: CellContext<LogbookEntry, unknown>) => {
|
||||
return (
|
||||
<Actions id={info.row.original.id} />
|
||||
<div className='dropdown dropdown-end'>
|
||||
<div tabIndex={0} role='button' className='btn btn-ghost'><FontAwesomeIcon icon={faEllipsisVertical} /></div>
|
||||
<ul tabIndex={-1} className="dropdown-content menu bg-base-100 rounded-box w-52 p-2 shadow-sm border border-base-300 !z-[100]">
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onOpenCloseDrawer(FormMode.EDIT, info.row.original.id)}><FontAwesomeIcon icon={faPen} />Edit</a></li>
|
||||
}
|
||||
<li><a onClick={() => onOpenCloseDrawer(FormMode.VIEW, info.row.original.id)}><FontAwesomeIcon icon={faEye} />View</a></li>
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onDeleteLog(info.row.original.id)}><FontAwesomeIcon icon={faTrash} />Delete</a></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -380,13 +370,13 @@ const Logbook: React.FC<unknown> = () => {
|
||||
setPageIndex
|
||||
} = table;
|
||||
|
||||
const getLogbookEntries = async (pageIndex: number, pageSize: number) => {
|
||||
const getLogbookEntries = async (pageIndex?: number, pageSize?: number) => {
|
||||
try {
|
||||
dispatch({ type: 'SET_IS_LOADING', payload: true });
|
||||
|
||||
const response: AxiosResponse = await httpClient.get(`api/logs`, {
|
||||
params: {
|
||||
skip: pageIndex * pageSize,
|
||||
skip: pageIndex,
|
||||
take: pageSize
|
||||
}
|
||||
});
|
||||
@@ -413,7 +403,7 @@ const Logbook: React.FC<unknown> = () => {
|
||||
setColumnVisibility(columnVisibility)
|
||||
dispatch({ type: 'SET_ENTRIES', payload: { entries: entries, totalEntries: response.data.total }});
|
||||
|
||||
if (!isUserLoggedIn && response.data.entities.length >= 5) {
|
||||
if (!isUserLoggedIn && response.data.length >= 5) {
|
||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of log entries displayed. Sign in to view all log entries.'}})
|
||||
} else {
|
||||
dispatch({ type: 'SET_ALERT', payload: undefined})
|
||||
@@ -499,11 +489,12 @@ const Logbook: React.FC<unknown> = () => {
|
||||
};
|
||||
|
||||
const onRowsPerPageChanged = (event: any) => {
|
||||
console.log(event.target.value)
|
||||
const newPaginationState: PaginationState = {
|
||||
pageIndex: 0,
|
||||
pageSize: event.target.value !== 'All' ? Number(event.target.value) : state.totalEntries
|
||||
};
|
||||
|
||||
console.log(newPaginationState)
|
||||
dispatch({ type: 'SET_PAGINATION', payload: newPaginationState })
|
||||
}
|
||||
|
||||
@@ -527,17 +518,13 @@ const Logbook: React.FC<unknown> = () => {
|
||||
dispatch({ type: 'SET_PAGES', payload: pages })
|
||||
}, [state.totalEntries, state.pagination?.pageSize])
|
||||
|
||||
useEffect(() => {
|
||||
console.log(state.alert)
|
||||
}, [state.alert])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
|
||||
<div className='prose max-w-none col-span-6 mt-5 mb-5'>
|
||||
<div className='mr-10 ml-10 grid grid-cols-12'>
|
||||
<div className='prose max-w-none col-span-10 mt-5 mb-5'>
|
||||
<h1>Logbook</h1>
|
||||
</div>
|
||||
<div className='col-span-6 justify-self-end self-center'>
|
||||
<div className='col-span-2 justify-self-end self-center'>
|
||||
{userRole === UserRole.WRITE &&
|
||||
<button className='btn btn-primary'
|
||||
onClick={() => onOpenCloseDrawer(FormMode.ADD)}
|
||||
@@ -554,14 +541,14 @@ const Logbook: React.FC<unknown> = () => {
|
||||
onClose={() =>
|
||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
||||
}
|
||||
severity={state.alert.severity}
|
||||
severity={'info'}
|
||||
>
|
||||
{state.alert.message}
|
||||
</Alert>
|
||||
</div>
|
||||
)}
|
||||
{!state.isLoading && state.entries.length > 0 && screenSize !== ScreenSize.SM && screenSize !== ScreenSize.MD && (
|
||||
<div className='col-span-12 pr-5 pb-5 pl-5 bg-base-100 border border-base-100 rounded-lg'>
|
||||
{!state.isLoading && state.entries.length > 0 && screenSize !== ScreenSize.SM && (
|
||||
<div className='col-span-12 pr-5 pb-5 pl-5 bg-base-100 border border-base-100 rounded-lg '>
|
||||
<div className='overflow-x-auto mb-5'>
|
||||
<div className='col-span-12 justify-self-end self-center mt-1 mr-1 mb-2'>
|
||||
<label className='select select-sm select-ghost'>
|
||||
@@ -573,7 +560,7 @@ const Logbook: React.FC<unknown> = () => {
|
||||
>
|
||||
<option value={10}>10</option>
|
||||
<option value={25}>25</option>
|
||||
<option value={50}>50</option>
|
||||
<option value={3}>50</option>
|
||||
<option value={state.totalEntries}>All</option>
|
||||
</select>
|
||||
</label>
|
||||
@@ -709,47 +696,7 @@ const Logbook: React.FC<unknown> = () => {
|
||||
</div>
|
||||
)}
|
||||
{state.entries.length > 0 && screenSize === ScreenSize.SM &&
|
||||
<div className='col-span-12'>
|
||||
<>
|
||||
{table.getRowModel().rows.map((row) => {
|
||||
const date = new Date(row.original.date.replace('Z', ''));
|
||||
const formattedDate: string = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
|
||||
|
||||
return (
|
||||
<div className='card bg-base-100 border border-base-300 mb-5'>
|
||||
<div className={`card-body ${screenSize === ScreenSize.SM || screenSize === ScreenSize.MD ? 'p-4' : ''}`} key={row.id}>
|
||||
<div className={`grid grid-cols-12 gap-3`}>
|
||||
<>
|
||||
<div className='col-span-8'>
|
||||
<h2 className='card-title font-bold text-2xl'>{formattedDate}</h2>
|
||||
</div>
|
||||
<div className='col-span-4 justify-self-end self-center'>
|
||||
<Actions id={row.original.id} />
|
||||
</div>
|
||||
{row.getVisibleCells().map((cell) => {
|
||||
return (
|
||||
<>
|
||||
{cell.column.columnDef.header !== 'Actions' && cell.column.columnDef.header !== 'Date' && cell.column.columnDef.header !== 'Pilot' &&
|
||||
<>
|
||||
<div className='col-span-8 font-bold'>
|
||||
<span>{cell.getContext().column.columnDef.header?.toString()}</span>
|
||||
</div>
|
||||
<div className='col-span-4'>
|
||||
<span>{flexRender(cell.column.columnDef.cell, cell.getContext())}</span>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
</div>
|
||||
<LogbookCard logs={state.entries} onDelete={onDeleteLog} mode='logbook' onOpenCloseForm={onOpenCloseDrawer} />
|
||||
}
|
||||
{state.isLoading && !state.alert && (
|
||||
<div className='col-span-12 p-5 bg-base-100 border border-base-100 rounded-lg'>
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { LogbookCardProps } from "./LogbookCardProps.interface";
|
||||
import TrackMap from "../trackMap/TrackMap";
|
||||
import { useBreakpoints } from "../../hooks/useBreakpoints/UseBreakpoints";
|
||||
import { ScreenSize } from "../../enums/screenSize";
|
||||
import { useEffect } from "react";
|
||||
|
||||
const LogbookCard = ({ logs, mode, onDelete, onOpenCloseForm }: LogbookCardProps) => {
|
||||
const { screenSize } = useBreakpoints();
|
||||
|
||||
return (
|
||||
<div>
|
||||
{logs.map((log) => {
|
||||
@@ -14,8 +9,8 @@ const LogbookCard = ({ logs, mode, onDelete, onOpenCloseForm }: LogbookCardProps
|
||||
const formattedDate: string = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
|
||||
|
||||
return (
|
||||
<div className='card bg-base-100 border border-base-300 p-2 mb-5'>
|
||||
<div className={`card-body ${screenSize === ScreenSize.SM || screenSize === ScreenSize.MD ? 'p-2' : ''}`} key={log.id}>
|
||||
<div className='card bg-base-100 border border-base-300 p-2'>
|
||||
<div className='card-body' key={log.id}>
|
||||
<h2 className='card-title font-bold text-2xl'>{formattedDate}</h2>
|
||||
<div>
|
||||
{mode === 'flights' && log.tracks && log.tracks.length > 0 &&
|
||||
@@ -29,10 +24,10 @@ const LogbookCard = ({ logs, mode, onDelete, onOpenCloseForm }: LogbookCardProps
|
||||
}
|
||||
</div>
|
||||
<div className='collapse collapse-arrow bg-base-100 border-base-300 border'>
|
||||
<input type='checkbox' />
|
||||
<input type='radio' name='details-accordion' />
|
||||
<div className='collapse-title font-semibold'>Details</div>
|
||||
<div className='collapse-content'>
|
||||
<div className={`grid grid-cols-12 gap-3 ${screenSize === ScreenSize.SM || screenSize === ScreenSize.MD ? 'mr-[5%] ml-[5%]' : 'mr-[30%] ml-[30%]'} mt-4 mb-4`}>
|
||||
<div className='grid grid-cols-12 gap-3 mr-[30%] ml-[30%] mt-4 mb-4'>
|
||||
<div className='col-span-6 font-bold'>
|
||||
<span>Aircraft Make and Model</span>
|
||||
</div>
|
||||
|
||||
@@ -17,31 +17,11 @@ import { Pilot } from './Pilot.interface';
|
||||
import Alert from '../alert/Alert';
|
||||
import { useOidc } from '../../auth/oidcConfig';
|
||||
|
||||
interface ActionsProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const Pilots: React.FC<unknown> = () => {
|
||||
const [state, dispatch] = useReducer(reducer, initialState);
|
||||
const { userRole } = useUserRole();
|
||||
const { screenSize } = useBreakpoints();
|
||||
const { isUserLoggedIn } = useOidc();
|
||||
const Actions = ({ id }: ActionsProps) => {
|
||||
return (
|
||||
<div className='dropdown dropdown-end'>
|
||||
<div tabIndex={0} role='button' className='btn btn-ghost'><FontAwesomeIcon icon={faEllipsisVertical} /></div>
|
||||
<ul tabIndex={-1} className="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm border border-base-300">
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onOpenClosePilotForm(FormMode.EDIT, id)}><FontAwesomeIcon icon={faPen} />Edit</a></li>
|
||||
}
|
||||
<li><a onClick={() => onOpenClosePilotForm(FormMode.VIEW, id)}><FontAwesomeIcon icon={faEye} />View</a></li>
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onDeletePilot(id)}><FontAwesomeIcon icon={faTrash} />Delete</a></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const getPilots = async () => {
|
||||
try {
|
||||
@@ -154,7 +134,18 @@ const Pilots: React.FC<unknown> = () => {
|
||||
},
|
||||
cell: (info: CellContext<Pilot, unknown>) => {
|
||||
return (
|
||||
<Actions id={info.row.original.id} />
|
||||
<div className='dropdown dropdown-end'>
|
||||
<div tabIndex={0} role='button' className='btn btn-ghost'><FontAwesomeIcon icon={faEllipsisVertical} /></div>
|
||||
<ul tabIndex={-1} className="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm border border-base-300">
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onOpenClosePilotForm(FormMode.EDIT, info.row.original.id)}><FontAwesomeIcon icon={faPen} />Edit</a></li>
|
||||
}
|
||||
<li><a onClick={() => onOpenClosePilotForm(FormMode.VIEW, info.row.original.id)}><FontAwesomeIcon icon={faEye} />View</a></li>
|
||||
{isUserLoggedIn && userRole === UserRole.WRITE &&
|
||||
<li><a onClick={() => onDeletePilot(info.row.original.id)}><FontAwesomeIcon icon={faTrash} />Delete</a></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -181,11 +172,11 @@ const Pilots: React.FC<unknown> = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
|
||||
<div className='prose max-w-none col-span-6 mt-5 mb-5' >
|
||||
<div className='mr-10 ml-10 grid grid-cols-12'>
|
||||
<div className='prose max-w-none col-span-10 mt-5 mb-5' >
|
||||
<h1>Pilots</h1>
|
||||
</div>
|
||||
<div className='col-span-6 justify-self-end self-center'>
|
||||
<div className='col-span-2 justify-self-end self-center'>
|
||||
{!state.isLoading && userRole === UserRole.WRITE &&
|
||||
<button
|
||||
className='btn btn-primary'
|
||||
@@ -268,40 +259,9 @@ const Pilots: React.FC<unknown> = () => {
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
{state.pilots.length > 0 && screenSize === ScreenSize.SM &&
|
||||
<div className='col-span-12'>
|
||||
<>
|
||||
{table.getRowModel().rows.map((row) => {
|
||||
return (
|
||||
<div className='card bg-base-100 border border-base-300 mb-5'>
|
||||
<div className={`card-body ${screenSize === ScreenSize.SM || screenSize === ScreenSize.MD ? 'p-4' : ''}`} key={row.id}>
|
||||
<div className={`grid grid-cols-12 gap-3`}>
|
||||
<>
|
||||
{row.getVisibleCells().map((cell) => {
|
||||
return (
|
||||
<>
|
||||
{cell.column.columnDef.header !== 'Actions' &&
|
||||
<>
|
||||
<div className='col-span-10 self-center'>
|
||||
<span>{flexRender(cell.column.columnDef.cell, cell.getContext())}</span>
|
||||
</div>
|
||||
<div className='col-span-2'>
|
||||
<Actions id={row.original.id} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
</div>
|
||||
}
|
||||
{/* {state.pilots.length > 0 && screenSize === ScreenSize.SM &&
|
||||
<PilotCard pilots={state.pilots} onDelete={onDeletePilot} onOpenCloseForm={onOpenClosePilotForm} />
|
||||
} */}
|
||||
</div>
|
||||
{state.isFormOpen && (
|
||||
<PilotForm
|
||||
|
||||
@@ -13,7 +13,6 @@ export default defineConfig({
|
||||
strictPort: true
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
port: 8080,
|
||||
proxy: {
|
||||
'/api': {
|
||||
|
||||
@@ -3,30 +3,15 @@ version: '3.8'
|
||||
services:
|
||||
azurite:
|
||||
container_name: azurite-flying
|
||||
image: mcr.microsoft.com/azure-storage/azurite
|
||||
image: mcr.microsoft.com/azure-storage/azurite
|
||||
ports:
|
||||
- '10000:10000'
|
||||
- '10001:10001'
|
||||
- '10002:10002'
|
||||
command: 'azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose --skipApiVersionCheck'
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "127.0.0.1", "10000"]
|
||||
volumes:
|
||||
- ./azurite-data:/data
|
||||
|
||||
seed:
|
||||
image: mcr.microsoft.com/azure-cli
|
||||
depends_on:
|
||||
azurite:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./seed-data:/data
|
||||
entrypoint: >
|
||||
sh -c "
|
||||
az storage container create --name mycontainer --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;' &&
|
||||
az storage blob upload-batch --destination mycontainer --source /data --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;'
|
||||
"
|
||||
|
||||
restore:
|
||||
container_name: restore
|
||||
image: litestream/litestream:0.3.13
|
||||
@@ -66,7 +51,6 @@ services:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
azurite-data:
|
||||
# azurite-data:
|
||||
backup:
|
||||
data:
|
||||
seed-data:
|
||||
data:
|
||||
3
infrastructure/.gitignore
vendored
3
infrastructure/.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
# Terraform
|
||||
.terraform/*
|
||||
*.tfstate
|
||||
*.tfstate.*
|
||||
.DS_Store
|
||||
*.tfstate.*
|
||||
@@ -1 +0,0 @@
|
||||
container_name = "tfstate-flying-prod"
|
||||
@@ -1 +0,0 @@
|
||||
container_name = "tfstate-flying-test"
|
||||
@@ -16,9 +16,12 @@ terraform {
|
||||
}
|
||||
}
|
||||
|
||||
backend "azurerm" {
|
||||
resource_group_name = "noahspan"
|
||||
storage_account_name = "noahspanterraform"
|
||||
key = "terraform.tfstate"
|
||||
backend "remote" {
|
||||
hostname = "app.terraform.io"
|
||||
organization = "noahspan"
|
||||
|
||||
workspaces {
|
||||
prefix = "noahspan-"
|
||||
}
|
||||
}
|
||||
}
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@noahspan/flying",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.0-alpha-3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@noahspan/flying",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.0-alpha-3",
|
||||
"workspaces": [
|
||||
"api",
|
||||
"client",
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
},
|
||||
"api": {
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.0-alpha-3",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@azure/storage-blob": "^12.27.0",
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
},
|
||||
"client": {
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.0-alpha-3",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^7.1.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@noahspan/flying",
|
||||
"version": "2.1.5",
|
||||
"version": "2.0.2",
|
||||
"scripts": {
|
||||
"start": "node api/dist/main",
|
||||
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
||||
|
||||
Reference in New Issue
Block a user