Compare commits
9 Commits
main
...
feature/1-
| Author | SHA1 | Date | |
|---|---|---|---|
| 48b09cb696 | |||
| 999c691fb5 | |||
| 941627b0bd | |||
| 19eb459c48 | |||
| 335556e7fe | |||
| fd5dcf5756 | |||
| f6daf6e7d3 | |||
| 0076d56475 | |||
| 9c8468eca8 |
4
.github/workflows/main.yaml
vendored
4
.github/workflows/main.yaml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- build-api
|
- build-api
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: root-api
|
app_name: flying-api
|
||||||
environment_name: test
|
environment_name: test
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
- build-app
|
- build-app
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: root-app
|
app_name: flying-app
|
||||||
environment_name: test
|
environment_name: test
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
4
.github/workflows/tag.yaml
vendored
4
.github/workflows/tag.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
- build-api
|
- build-api
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: root-api
|
app_name: flying-api
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
version_number: ${{ github.ref_name }}
|
version_number: ${{ github.ref_name }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- build-app
|
- build-app
|
||||||
uses: ./.github/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: root-app
|
app_name: flying-app
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
version_number: ${{ github.ref_name }}
|
version_number: ${{ github.ref_name }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||||
|
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||||
|
|
||||||
|
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
||||||
|
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||||
|
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
||||||
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||||
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||||
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||||
|
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||||
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||||
|
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||||
|
</p>
|
||||||
|
<!--[](https://opencollective.com/nest#backer)
|
||||||
|
[](https://opencollective.com/nest#sponsor)-->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the app
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# development
|
||||||
|
$ npm run start
|
||||||
|
|
||||||
|
# watch mode
|
||||||
|
$ npm run start:dev
|
||||||
|
|
||||||
|
# production mode
|
||||||
|
$ npm run start:prod
|
||||||
|
```
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# unit tests
|
||||||
|
$ npm run test
|
||||||
|
|
||||||
|
# e2e tests
|
||||||
|
$ npm run test:e2e
|
||||||
|
|
||||||
|
# test coverage
|
||||||
|
$ npm run test:cov
|
||||||
|
```
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||||
|
|
||||||
|
## Stay in touch
|
||||||
|
|
||||||
|
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||||
|
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||||
|
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Nest is [MIT licensed](LICENSE).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"version": "1.2.0",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -20,24 +20,25 @@
|
|||||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@azure/functions": "^1.0.3",
|
||||||
"@nestjs/axios": "^4.0.0",
|
"@nestjs/axios": "^4.0.0",
|
||||||
"@nestjs/azure-func-http": "^0.10.0",
|
"@nestjs/azure-func-http": "^0.10.0",
|
||||||
"@nestjs/common": "^11.0.11",
|
"@nestjs/common": "^10.0.0",
|
||||||
"@nestjs/config": "^4.0.1",
|
"@nestjs/config": "^4.0.0",
|
||||||
"@nestjs/core": "^11.0.11",
|
"@nestjs/core": "^10.0.0",
|
||||||
"@nestjs/platform-express": "^11.0.11",
|
"@nestjs/platform-express": "^10.0.0",
|
||||||
"@noahspan/azure-database": "^3.1.2",
|
"@noahspan/azure-database": "^3.1.2",
|
||||||
"@noahspan/noahspan-modules": "^1.1.5",
|
"@noahspan/noahspan-modules": "^0.6.5",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.1.14",
|
||||||
"rxjs": "7.8.2",
|
"rxjs": "^7.8.1",
|
||||||
"uuid": "^11.0.5"
|
"uuid": "^11.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/schematics": "^19.1.4",
|
"@angular-devkit/schematics": "^19.1.4",
|
||||||
"@nestjs/cli": "^11.0.5",
|
"@nestjs/cli": "^10.0.0",
|
||||||
"@nestjs/schematics": "^11.0.2",
|
"@nestjs/schematics": "^10.0.0",
|
||||||
"@nestjs/testing": "^11.0.11",
|
"@nestjs/testing": "^10.0.0",
|
||||||
"@schematics/angular": "^19.1.4",
|
"@schematics/angular": "^19.1.4",
|
||||||
"@types/express": "^4.17.17",
|
"@types/express": "^4.17.17",
|
||||||
"@types/jest": "^29.5.2",
|
"@types/jest": "^29.5.2",
|
||||||
@@ -58,9 +59,6 @@
|
|||||||
"tsconfig-paths": "^4.2.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.1.3"
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
"js",
|
"js",
|
||||||
|
|||||||
78
api/src/app.controller.ts
Normal file
78
api/src/app.controller.ts
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import {
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Headers,
|
||||||
|
Query,
|
||||||
|
StreamableFile,
|
||||||
|
UseGuards
|
||||||
|
} from '@nestjs/common';
|
||||||
|
// import { Client as MsGraphClient } from '@microsoft/microsoft-graph-client';
|
||||||
|
import { MsGraphService } from '@noahspan/noahspan-modules'
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
export class AppController {
|
||||||
|
constructor(
|
||||||
|
private readonly msGraphService: MsGraphService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Get('userPhoto')
|
||||||
|
async getProfilePhoto(@Headers() headers: any): Promise<StreamableFile> {
|
||||||
|
// try {
|
||||||
|
// const graphToken: string = await this.msGraphService.getMsGraphAuth(
|
||||||
|
// headers.authorization.replace('Bearer ', ''),
|
||||||
|
// ['user.read']
|
||||||
|
// );
|
||||||
|
// const client: MsGraphClient =
|
||||||
|
// await this.msGraphService.getMsGraphClientDelegated(graphToken);
|
||||||
|
// const blob: Blob = await client.api(`me/photos('48x48')/$value`).get();
|
||||||
|
// const arrayBuffer: ArrayBuffer = await blob.arrayBuffer();
|
||||||
|
// const buffer: Buffer = Buffer.from(arrayBuffer);
|
||||||
|
|
||||||
|
// return new StreamableFile(buffer, {
|
||||||
|
// type: 'application/json',
|
||||||
|
// disposition: `attachment; filename="user_photo.png"`
|
||||||
|
// });
|
||||||
|
// } catch (error) {
|
||||||
|
// return error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
try {
|
||||||
|
const buffer = await this.msGraphService.getProfilePhoto(
|
||||||
|
headers.authorization.replace('Bearer ', ''),
|
||||||
|
['user.read']
|
||||||
|
)
|
||||||
|
|
||||||
|
return new StreamableFile(buffer, {
|
||||||
|
type: 'application/json',
|
||||||
|
disposition: `attachment; filename="user_photo.png"`
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('userProfile')
|
||||||
|
async getUserProfile(@Headers() headers: any): Promise<any> {
|
||||||
|
// try {
|
||||||
|
// const graphToken: string = await this.msGraphService.getMsGraphAuth(
|
||||||
|
// headers.authorization.replace('Bearer ', ''),
|
||||||
|
// ['user.read']
|
||||||
|
// );
|
||||||
|
// const client: MsGraphClient =
|
||||||
|
// await this.msGraphService.getMsGraphClientDelegated(graphToken);
|
||||||
|
// const userProfile = await client.api(`me`).get();
|
||||||
|
|
||||||
|
// return userProfile;
|
||||||
|
// } catch (error) {
|
||||||
|
// return error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
try {
|
||||||
|
const userProfile = await this.msGraphService.getUserProfile(headers.authorization.replace('Bearer ', ''));
|
||||||
|
|
||||||
|
return userProfile;
|
||||||
|
} catch (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { APP_FILTER } from '@nestjs/core';
|
import { APP_FILTER, APP_GUARD } from '@nestjs/core';
|
||||||
import { HttpExceptionFilter } from './filters/http-exception.filter';
|
import { HttpExceptionFilter } from './filters/http-exception.filter';
|
||||||
import { ProjectModule } from './project/project.module';
|
import { ProjectModule } from './project/project.module';
|
||||||
import { AuthModule, UserModule } from '@noahspan/noahspan-modules'
|
import { AuthGuard, AuthModule, MsGraphModule } from '@noahspan/noahspan-modules'
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||||
import configuration from './config/configuration';
|
import configuration from './config/configuration';
|
||||||
|
import { AppController } from './app.controller';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -22,7 +23,7 @@ import configuration from './config/configuration';
|
|||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
load: [configuration]
|
load: [configuration]
|
||||||
}),
|
}),
|
||||||
UserModule.registerAsync({
|
MsGraphModule.registerAsync({
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
||||||
useFactory: async (configService: ConfigService) => {
|
useFactory: async (configService: ConfigService) => {
|
||||||
@@ -35,10 +36,15 @@ import configuration from './config/configuration';
|
|||||||
}),
|
}),
|
||||||
ProjectModule
|
ProjectModule
|
||||||
],
|
],
|
||||||
|
controllers: [AppController],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: APP_FILTER,
|
provide: APP_FILTER,
|
||||||
useClass: HttpExceptionFilter
|
useClass: HttpExceptionFilter
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: APP_GUARD,
|
||||||
|
useClass: AuthGuard
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
export default () => ({
|
export default () => ({
|
||||||
azureStorageConnectionString: process.env.AZURE_STORAGE_CONNECTION_STRING,
|
|
||||||
clientId: process.env.CLIENT_ID,
|
clientId: process.env.CLIENT_ID,
|
||||||
clientSecret: process.env.CLIENT_SECRET,
|
clientSecret: process.env.CLIENT_SECRET,
|
||||||
tenantId: process.env.TENANT_ID
|
tenantId: process.env.TENANT_ID
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
@@ -12,14 +12,13 @@ import {
|
|||||||
import { ProjectDto } from './project.dto';
|
import { ProjectDto } from './project.dto';
|
||||||
import { Project } from './project.entity';
|
import { Project } from './project.entity';
|
||||||
import { ProjectService } from './project.service';
|
import { ProjectService } from './project.service';
|
||||||
import { AuthGuard, CustomError, Public } from '@noahspan/noahspan-modules';
|
import { CustomError, Public } from '@noahspan/noahspan-modules';
|
||||||
|
|
||||||
@Controller('projects')
|
@Controller('projects')
|
||||||
export class ProjectController {
|
export class ProjectController {
|
||||||
constructor(private readonly projectService: ProjectService) {}
|
constructor(private readonly projectService: ProjectService) {}
|
||||||
|
|
||||||
@Get(':partitionKey/:rowKey')
|
@Get(':partitionKey/:rowKey')
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
async find(
|
async find(
|
||||||
@Param('partitionKey') partitionKey: string,
|
@Param('partitionKey') partitionKey: string,
|
||||||
@Param('rowKey') rowKey: string
|
@Param('rowKey') rowKey: string
|
||||||
@@ -33,12 +32,12 @@ export class ProjectController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Public()
|
||||||
@Get()
|
@Get()
|
||||||
async findAll() {
|
async findAll() {
|
||||||
try {
|
try {
|
||||||
return await this.projectService.findAll();
|
return await this.projectService.findAll();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
|
||||||
const customError = error as CustomError;
|
const customError = error as CustomError;
|
||||||
|
|
||||||
throw new HttpException(customError.message, customError.statusCode);
|
throw new HttpException(customError.message, customError.statusCode);
|
||||||
@@ -46,7 +45,6 @@ export class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
async create(@Body() projectDto: ProjectDto) {
|
async create(@Body() projectDto: ProjectDto) {
|
||||||
try {
|
try {
|
||||||
const project = new Project();
|
const project = new Project();
|
||||||
@@ -62,7 +60,6 @@ export class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':partitionKey/:rowKey')
|
@Put(':partitionKey/:rowKey')
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
async update(
|
async update(
|
||||||
@Param('partitionKey') partitionKey: string,
|
@Param('partitionKey') partitionKey: string,
|
||||||
@Param('rowKey') rowKey: string,
|
@Param('rowKey') rowKey: string,
|
||||||
@@ -82,7 +79,6 @@ export class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':partitionKey/:rowKey')
|
@Delete(':partitionKey/:rowKey')
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
async delete(
|
async delete(
|
||||||
@Param('partitionKey') partitionKey: string,
|
@Param('partitionKey') partitionKey: string,
|
||||||
@Param('rowKey') rowKey: string
|
@Param('rowKey') rowKey: string
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { EntityString } from '@noahspan/azure-database';
|
|
||||||
|
|
||||||
export class Project {
|
export class Project {
|
||||||
@EntityString() partitionKey: string;
|
partitionKey: string;
|
||||||
@EntityString() rowKey: string;
|
rowKey: string;
|
||||||
@EntityString() displayName: string;
|
displayName: string;
|
||||||
@EntityString() icon: string;
|
icon: string;
|
||||||
@EntityString() summary: string;
|
summary: string;
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
|
|||||||
inject: [ConfigService]
|
inject: [ConfigService]
|
||||||
}),
|
}),
|
||||||
AzureTableStorageModule.forFeature(Project, {
|
AzureTableStorageModule.forFeature(Project, {
|
||||||
createTableIfNotExists: false,
|
createTableIfNotExists: true,
|
||||||
table: 'projects'
|
table: 'projects'
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { InjectRepository, Repository } from '@noahspan/azure-database';
|
import { InjectRepository, Repository } from '@noahspan/azure-database';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { Project } from './project.entity';
|
import { Project } from './project.entity';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ProjectService {
|
export class ProjectService {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
# APP
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export interface Alert {
|
|
||||||
severity: 'success' | 'error' | 'info' | 'warning';
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
0
app/.gitignore → app2/.gitignore
vendored
0
app/.gitignore → app2/.gitignore
vendored
50
app2/README.md
Normal file
50
app2/README.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# React + TypeScript + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
||||||
|
|
||||||
|
- Configure the top-level `parserOptions` property like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default tseslint.config({
|
||||||
|
languageOptions: {
|
||||||
|
// other options...
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
||||||
|
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
||||||
|
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// eslint.config.js
|
||||||
|
import react from 'eslint-plugin-react'
|
||||||
|
|
||||||
|
export default tseslint.config({
|
||||||
|
// Set the react version
|
||||||
|
settings: { react: { version: '18.3' } },
|
||||||
|
plugins: {
|
||||||
|
// Add the react plugin
|
||||||
|
react,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// other rules...
|
||||||
|
// Enable its recommended rules
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs['jsx-runtime'].rules,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "app",
|
"name": "app2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.2.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"@azure/msal-browser": "^4.2.1",
|
"@azure/msal-browser": "^4.2.1",
|
||||||
"@azure/msal-react": "^3.0.4",
|
"@azure/msal-react": "^3.0.4",
|
||||||
"@microsoft/microsoft-graph-types": "^2.40.0",
|
"@microsoft/microsoft-graph-types": "^2.40.0",
|
||||||
"@noahspan/noahspan-components": "^1.8.1",
|
"@noahspan/noahspan-components": "^1.3.1",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
@@ -32,8 +32,5 @@
|
|||||||
"typescript": "~5.7.2",
|
"typescript": "~5.7.2",
|
||||||
"typescript-eslint": "^8.22.0",
|
"typescript-eslint": "^8.22.0",
|
||||||
"vite": "^6.1.0"
|
"vite": "^6.1.0"
|
||||||
},
|
}
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -1,6 +1,7 @@
|
|||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
import Projects from './components/projects/Projects';
|
import Projects from './components/projects/Projects';
|
||||||
import SiteNav from './components/siteNav/SiteNav';
|
import SiteNav from './components/siteNav/SiteNav';
|
||||||
|
import { useAppContext } from './hooks/appContext/UseAppContext';
|
||||||
import { IPublicClientApplication } from '@azure/msal-browser';
|
import { IPublicClientApplication } from '@azure/msal-browser';
|
||||||
import { MsalProvider } from '@azure/msal-react';
|
import { MsalProvider } from '@azure/msal-react';
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@ interface AppProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const App = ({ pca }: AppProps) => {
|
const App = ({ pca }: AppProps) => {
|
||||||
|
const appContext = useAppContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MsalProvider instance={pca}>
|
<MsalProvider instance={pca}>
|
||||||
<SiteNav />
|
<SiteNav />
|
||||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -3,7 +3,6 @@ import { ActionMenuProps } from './ActionMenuProps.interface';
|
|||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
IconButton,
|
IconButton,
|
||||||
IconName,
|
|
||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -27,7 +26,7 @@ const ActionMenu = ({ id, onDelete, onOpenCloseForm }: ActionMenuProps) => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<IconButton onClick={onOpenActionMenu}>
|
<IconButton onClick={onOpenActionMenu}>
|
||||||
<Icon iconName={IconName.ELLIPSIS_VERTICAL} size="sm" />
|
<Icon iconName='fa-ellipsis-vertical' size="sm" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Menu
|
<Menu
|
||||||
anchorEl={anchorElAction}
|
anchorEl={anchorElAction}
|
||||||
@@ -37,20 +36,20 @@ const ActionMenu = ({ id, onDelete, onOpenCloseForm }: ActionMenuProps) => {
|
|||||||
>
|
>
|
||||||
<MenuItem onClick={() => onOpenCloseForm(FormMode.EDIT, id)}>
|
<MenuItem onClick={() => onOpenCloseForm(FormMode.EDIT, id)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<Icon iconName={IconName.PEN} size="lg" />
|
<Icon iconName='fa-pen' size="lg" />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>Edit</ListItemText>
|
<ListItemText>Edit</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => onOpenCloseForm(FormMode.VIEW, id)}>
|
<MenuItem onClick={() => onOpenCloseForm(FormMode.VIEW, id)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<Icon iconName={IconName.EYE} size="lg" />
|
<Icon iconName='fa-eye' size="lg" />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>View</ListItemText>
|
<ListItemText>View</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<hr className="my-3" />
|
<hr className="my-3" />
|
||||||
<MenuItem onClick={() => onDelete(id)}>
|
<MenuItem onClick={() => onDelete(id)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<Icon iconName={IconName.TRASH} size="lg" />
|
<Icon iconName='fa-trash' size="lg" />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>Delete</ListItemText>
|
<ListItemText>Delete</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
@@ -6,7 +7,6 @@ import {
|
|||||||
DialogContentText,
|
DialogContentText,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Icon,
|
Icon,
|
||||||
IconName,
|
|
||||||
Spinner
|
Spinner
|
||||||
} from '@noahspan/noahspan-components';
|
} from '@noahspan/noahspan-components';
|
||||||
import { ConfirmationDialogProps } from './ConfirmationDialogProps.interface';
|
import { ConfirmationDialogProps } from './ConfirmationDialogProps.interface';
|
||||||
@@ -33,13 +33,13 @@ const ConfirmationDialog = ({
|
|||||||
{isLoading && <Spinner />}
|
{isLoading && <Spinner />}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={onCancel} variant="outlined" startIcon={<Icon iconName={IconName.XMARK} />}>
|
<Button onClick={onCancel} variant="outlined" startIcon={<Icon iconName='fa-xmark' />}>
|
||||||
No
|
No
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<Icon iconName={IconName.CIRCLE_CHECK}/>}
|
startIcon={<Icon iconName='fa-circle-check'/>}
|
||||||
>
|
>
|
||||||
Yes
|
Yes
|
||||||
</Button>
|
</Button>
|
||||||
@@ -15,7 +15,7 @@ import { initialState, reducer } from './reducer';
|
|||||||
import { ProjectFormProps } from './ProjectFormProps.interface';
|
import { ProjectFormProps } from './ProjectFormProps.interface';
|
||||||
import { FormMode } from '../../enums/formMode';
|
import { FormMode } from '../../enums/formMode';
|
||||||
import { useIsAuthenticated } from '@azure/msal-react';
|
import { useIsAuthenticated } from '@azure/msal-react';
|
||||||
import { useAccessToken } from '../../hooks/accessToken/UseAccessToken'
|
import { useAccessToken } from '../../hooks/accessToken/UseAccessToken';
|
||||||
import { useHttpClient } from '../../hooks/httpClient/UseHttpClient';
|
import { useHttpClient } from '../../hooks/httpClient/UseHttpClient';
|
||||||
import { AxiosError, AxiosInstance, AxiosResponse } from 'axios';
|
import { AxiosError, AxiosInstance, AxiosResponse } from 'axios';
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ const ProjectForm = ({ isDrawerOpen, mode, onOpenClose, projectId }: ProjectForm
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async (data: unknown) => {
|
const onSubmit = async (data: unknown) => {
|
||||||
|
console.log(data)
|
||||||
try {
|
try {
|
||||||
dispatch({ type: 'SET_IS_LOADING', payload: true });
|
dispatch({ type: 'SET_IS_LOADING', payload: true });
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Project } from './Project.interface';
|
import { Project } from './Project.interface';
|
||||||
import {
|
import {
|
||||||
Alert,
|
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -11,8 +10,6 @@ import {
|
|||||||
Grid,
|
Grid,
|
||||||
Icon,
|
Icon,
|
||||||
IconName,
|
IconName,
|
||||||
Skeleton,
|
|
||||||
Stack,
|
|
||||||
Typography
|
Typography
|
||||||
} from '@noahspan/noahspan-components';
|
} from '@noahspan/noahspan-components';
|
||||||
import { useIsAuthenticated } from '@azure/msal-react';
|
import { useIsAuthenticated } from '@azure/msal-react';
|
||||||
@@ -32,20 +29,36 @@ const Projects = () => {
|
|||||||
const isAuthenticated = useIsAuthenticated();
|
const isAuthenticated = useIsAuthenticated();
|
||||||
const { getAccessToken } = useAccessToken();
|
const { getAccessToken } = useAccessToken();
|
||||||
|
|
||||||
|
const findIconByName: IconName = (name: string) => {
|
||||||
|
const keys = Object.keys(IconName);
|
||||||
|
|
||||||
|
for (const key of keys) {
|
||||||
|
if (IconName[key] === name) {
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const getProjects = async (): Promise<Project[]> => {
|
const getProjects = async (): Promise<Project[]> => {
|
||||||
try {
|
try {
|
||||||
|
// const config = isAuthenticated
|
||||||
|
// ? { headers: { Authorization: await getAccessToken() } }
|
||||||
|
// : {};
|
||||||
const response: AxiosResponse = await httpClient.get(
|
const response: AxiosResponse = await httpClient.get(
|
||||||
`api/projects`,
|
`api/projects`,
|
||||||
|
// config
|
||||||
);
|
);
|
||||||
const projects: Project[] = response.data;
|
const projects: Project[] = response.data;
|
||||||
|
|
||||||
projects.sort((a, b) => Number(a.order) - Number(b.order));
|
projects.sort((a, b) => Number(a.order) - Number(b.order))
|
||||||
|
|
||||||
|
console.log(projects)
|
||||||
|
|
||||||
return projects;
|
return projects;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const axiosError = error as AxiosError;
|
throw new Error('broken');
|
||||||
|
|
||||||
throw new Error(axiosError.message);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,19 +107,19 @@ const Projects = () => {
|
|||||||
? { headers: { Authorization: `${token}` } }
|
? { headers: { Authorization: `${token}` } }
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
await httpClient.delete(`api/projects/project/${state.selectedProjectId}`, config);
|
// await httpClient.delete(`api/logs/log/${state.selectedEntryId}`, config);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SET_DELETE',
|
type: 'SET_DELETE',
|
||||||
payload: { isConfirmationDialogOpen: false, selectedProjectId: undefined }
|
payload: { isConfirmationDialogOpen: false, selectedProjectId: undefined }
|
||||||
});
|
});
|
||||||
await getProjects();
|
// await getProjects();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const axiosError = error as AxiosError;
|
const axiosError = error as AxiosError;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SET_ALERT',
|
type: 'SET_ERROR',
|
||||||
payload: { severity: 'error', message: `Loading of projects failed with the following message: ${axiosError.message}` }
|
payload: `Loading of logbook entries failed with the following message: ${axiosError.message}`
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
dispatch({ type: 'SET_IS_CONFIRMATION_DIALOG_LOADING', payload: false });
|
dispatch({ type: 'SET_IS_CONFIRMATION_DIALOG_LOADING', payload: false });
|
||||||
@@ -123,32 +136,16 @@ const Projects = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadProjects = async () => {
|
const loadProjects = async () => {
|
||||||
try {
|
try {
|
||||||
dispatch({ type: 'SET_IS_LOADING', payload: true })
|
|
||||||
const projects = await getProjects();
|
const projects = await getProjects();
|
||||||
|
|
||||||
if (projects.length > 0) {
|
dispatch({ type: 'SET_PROJECTS', payload: projects })
|
||||||
dispatch({ type: 'SET_PROJECTS', payload: projects });
|
|
||||||
|
|
||||||
if (state.alert) {
|
|
||||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No projects found.'}});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dispatch({
|
console.log(error);
|
||||||
type: 'SET_ALERT',
|
|
||||||
payload: { severity: 'error', message: `Loading of projects failed with the following message: ${error}` }
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
dispatch({ type: 'SET_IS_LOADING', payload: false })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.isFormOpen || !state.isConfirmDialogOpen) {
|
loadProjects()
|
||||||
loadProjects();
|
}, []);
|
||||||
}
|
|
||||||
}, [state.isFormOpen, state.isConfirmDialogOpen]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
@@ -161,27 +158,14 @@ const Projects = () => {
|
|||||||
{isAuthenticated &&
|
{isAuthenticated &&
|
||||||
<Button
|
<Button
|
||||||
onClick={() => onOpenCloseProjectForm(FormMode.ADD)}
|
onClick={() => onOpenCloseProjectForm(FormMode.ADD)}
|
||||||
startIcon={<Icon iconName={IconName.PLUS}/>}
|
startIcon={<Icon iconName='fa-plus' />}
|
||||||
variant='contained'
|
variant='contained'
|
||||||
>
|
>
|
||||||
Add Project
|
Add Project
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
</Grid>
|
</Grid>
|
||||||
{!state.isLoading && state.alert && (
|
{state.projects.length > 0 && state.projects.map((project: Project) => {
|
||||||
<Grid display="flex" justifyContent="center" size={12}>
|
|
||||||
<Alert
|
|
||||||
onClose={() =>
|
|
||||||
dispatch({ type: 'SET_ALERT', payload: undefined })
|
|
||||||
}
|
|
||||||
severity={state.alert.severity}
|
|
||||||
sx={{ width: '100%' }}
|
|
||||||
>
|
|
||||||
{state.alert.message}
|
|
||||||
</Alert>
|
|
||||||
</Grid>
|
|
||||||
)}
|
|
||||||
{!state.isLoading && state.projects.length > 0 && state.projects.map((project: Project) => {
|
|
||||||
return (
|
return (
|
||||||
<Grid display='flex' justifyContent='center' size={12}>
|
<Grid display='flex' justifyContent='center' size={12}>
|
||||||
<Card
|
<Card
|
||||||
@@ -191,7 +175,7 @@ const Projects = () => {
|
|||||||
>
|
>
|
||||||
<CardHeader
|
<CardHeader
|
||||||
action={isAuthenticated ? <ActionMenu id={project.rowKey} onDelete={onDeleteProject} onOpenCloseForm={onOpenCloseProjectForm} /> : null}
|
action={isAuthenticated ? <ActionMenu id={project.rowKey} onDelete={onDeleteProject} onOpenCloseForm={onOpenCloseProjectForm} /> : null}
|
||||||
avatar={<Icon iconName={project.iconName as IconName} size='2x' />}
|
avatar={<Icon iconName={IconName[findIconByName(project.iconName)]} size='2x' />}
|
||||||
subheader={project.subTitle}
|
subheader={project.subTitle}
|
||||||
title={project.title}
|
title={project.title}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
@@ -214,6 +198,7 @@ const Projects = () => {
|
|||||||
component='a'
|
component='a'
|
||||||
href={`https://github.com/noahspannbauer/${project.repoName}`}
|
href={`https://github.com/noahspannbauer/${project.repoName}`}
|
||||||
startIcon={<Icon iconName={IconName.GITHUB} />}
|
startIcon={<Icon iconName={IconName.GITHUB} />}
|
||||||
|
target='_blank'
|
||||||
>
|
>
|
||||||
Code
|
Code
|
||||||
</Button>
|
</Button>
|
||||||
@@ -230,42 +215,12 @@ const Projects = () => {
|
|||||||
}
|
}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</CardActions>
|
</CardActions>
|
||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{state.isLoading && [...Array(6)].map((_element, index) => {
|
|
||||||
return (
|
|
||||||
<Grid display='flex' justifyContent='center' size={12}>
|
|
||||||
<Card
|
|
||||||
key={index}
|
|
||||||
sx={{
|
|
||||||
width: '100%'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CardContent>
|
|
||||||
<Grid container spacing={2}>
|
|
||||||
<Grid size={1}>
|
|
||||||
<Skeleton height={100} width={60} />
|
|
||||||
</Grid>
|
|
||||||
<Grid size={11}>
|
|
||||||
<Stack>
|
|
||||||
<Skeleton height={60} />
|
|
||||||
<Skeleton height={30} />
|
|
||||||
</Stack>
|
|
||||||
</Grid>
|
|
||||||
<Grid size={12}>
|
|
||||||
<Skeleton />
|
|
||||||
<Skeleton />
|
|
||||||
<Skeleton />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Grid>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</Grid>
|
</Grid>
|
||||||
{state.isFormOpen &&
|
{state.isFormOpen &&
|
||||||
<ProjectForm
|
<ProjectForm
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
import { FormMode } from '../../enums/formMode';
|
import { FormMode } from '../../enums/formMode';
|
||||||
import { Alert } from '../../interfaces';
|
|
||||||
import { Project } from './Project.interface';
|
import { Project } from './Project.interface';
|
||||||
|
|
||||||
export interface ProjectsState {
|
export interface ProjectsState {
|
||||||
alert: Alert | undefined;
|
|
||||||
projects: Project[];
|
projects: Project[];
|
||||||
formMode: FormMode;
|
formMode: FormMode;
|
||||||
|
error: string | undefined;
|
||||||
isConfirmDialogLoading: boolean;
|
isConfirmDialogLoading: boolean;
|
||||||
isConfirmDialogOpen: boolean;
|
isConfirmDialogOpen: boolean;
|
||||||
isFormOpen: boolean;
|
isFormOpen: boolean;
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { FormMode } from '../../enums/formMode';
|
import { FormMode } from '../../enums/formMode';
|
||||||
import { ProjectsState } from './ProjectsState.interface'
|
import { ProjectsState } from './ProjectsState.interface'
|
||||||
import { Project } from './Project.interface';
|
import { Project } from './Project.interface';
|
||||||
import { Alert } from '../../interfaces';
|
|
||||||
|
|
||||||
type Action =
|
type Action =
|
||||||
| {
|
| {
|
||||||
@@ -12,7 +11,7 @@ type Action =
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
| { type: 'SET_PROJECTS'; payload: Project[] }
|
| { type: 'SET_PROJECTS'; payload: Project[] }
|
||||||
| { type: 'SET_ALERT'; payload: Alert | undefined }
|
| { type: 'SET_ERROR'; payload: string | undefined }
|
||||||
| { type: 'SET_FORM_MODE'; payload: FormMode }
|
| { type: 'SET_FORM_MODE'; payload: FormMode }
|
||||||
| { type: 'SET_IS_CONFIRMATION_DIALOG_LOADING'; payload: boolean }
|
| { type: 'SET_IS_CONFIRMATION_DIALOG_LOADING'; payload: boolean }
|
||||||
| { type: 'SET_IS_LOADING'; payload: boolean }
|
| { type: 'SET_IS_LOADING'; payload: boolean }
|
||||||
@@ -26,13 +25,13 @@ type Action =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const initialState: ProjectsState = {
|
export const initialState: ProjectsState = {
|
||||||
alert: undefined,
|
projects: [],
|
||||||
|
error: undefined,
|
||||||
formMode: FormMode.CANCEL,
|
formMode: FormMode.CANCEL,
|
||||||
isConfirmDialogLoading: false,
|
isConfirmDialogLoading: false,
|
||||||
isConfirmDialogOpen: false,
|
isConfirmDialogOpen: false,
|
||||||
isFormOpen: false,
|
isFormOpen: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
projects: [],
|
|
||||||
selectedProjectId: undefined
|
selectedProjectId: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,10 +53,10 @@ export const reducer = (
|
|||||||
projects: action.payload
|
projects: action.payload
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SET_ALERT': {
|
case 'SET_ERROR': {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
alert: action.payload
|
error: action.payload
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SET_FORM_MODE': {
|
case 'SET_FORM_MODE': {
|
||||||
@@ -3,9 +3,9 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { useAppContext } from '../../hooks/appContext/UseAppContext';
|
import { useAppContext } from '../../hooks/appContext/UseAppContext';
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
IconName,
|
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Navbar,
|
Navbar,
|
||||||
|
Spinner,
|
||||||
Typography
|
Typography
|
||||||
} from '@noahspan/noahspan-components';
|
} from '@noahspan/noahspan-components';
|
||||||
import { useIsAuthenticated, useMsal } from '@azure/msal-react';
|
import { useIsAuthenticated, useMsal } from '@azure/msal-react';
|
||||||
@@ -14,25 +14,21 @@ import { useHttpClient } from '../../hooks/httpClient/UseHttpClient';
|
|||||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||||
import { User } from '@microsoft/microsoft-graph-types';
|
import { User } from '@microsoft/microsoft-graph-types';
|
||||||
|
|
||||||
const SiteNav: React.FC<unknown> = () => {
|
const SiteNav = () => {
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [userPhoto, setUserPhoto] = useState<string>();
|
const [userPhoto, setUserPhoto] = useState<string>();
|
||||||
const [pages, setPages] = useState<{ name: string; url: string; }[]>([]);
|
|
||||||
const httpClient: AxiosInstance = useHttpClient();
|
const httpClient: AxiosInstance = useHttpClient();
|
||||||
const appContext = useAppContext();
|
const appContext = useAppContext();
|
||||||
const isAuthenticated = useIsAuthenticated();
|
const isAuthenticated = useIsAuthenticated();
|
||||||
const { getAccessToken } = useAccessToken();
|
const { getAccessToken } = useAccessToken();
|
||||||
const { instance } = useMsal();
|
const { instance } = useMsal();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const getPages = () => {
|
|
||||||
const pages = [
|
const pages = [
|
||||||
{
|
{
|
||||||
name: 'Projects',
|
name: 'Projects',
|
||||||
url: '/'
|
url: '/'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
setPages(pages)
|
|
||||||
};
|
|
||||||
const handleSignIn = () => {
|
const handleSignIn = () => {
|
||||||
instance.loginRedirect({
|
instance.loginRedirect({
|
||||||
scopes: [`api://${import.meta.env.VITE_CLIENT_ID}/user_impersonation`]
|
scopes: [`api://${import.meta.env.VITE_CLIENT_ID}/user_impersonation`]
|
||||||
@@ -43,7 +39,7 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
};
|
};
|
||||||
const getUserProfile = async (accessToken: string): Promise<User> => {
|
const getUserProfile = async (accessToken: string): Promise<User> => {
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse = await httpClient.get(`api/user/profile`, {
|
const response: AxiosResponse = await httpClient.get(`api/userProfile`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: accessToken
|
Authorization: accessToken
|
||||||
}
|
}
|
||||||
@@ -57,7 +53,7 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
};
|
};
|
||||||
const getUserPhoto = async (accessToken: string): Promise<string> => {
|
const getUserPhoto = async (accessToken: string): Promise<string> => {
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse = await httpClient.get(`api/user/photo`, {
|
const response: AxiosResponse = await httpClient.get(`api/userPhoto`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: accessToken
|
Authorization: accessToken
|
||||||
},
|
},
|
||||||
@@ -69,6 +65,7 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
|
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -79,7 +76,7 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
return (
|
return (
|
||||||
<MenuItem onClick={handleSignOut}>
|
<MenuItem onClick={handleSignOut}>
|
||||||
<Icon iconName={IconName.SIGN_OUT} />
|
<Icon iconName='fa-sign-out' />
|
||||||
<Typography sx={{ marginLeft: '10px', textAlign: 'center' }}>
|
<Typography sx={{ marginLeft: '10px', textAlign: 'center' }}>
|
||||||
Sign Out
|
Sign Out
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -90,6 +87,8 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const setUserProfile = async () => {
|
const setUserProfile = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
const accessToken: string = await getAccessToken();
|
const accessToken: string = await getAccessToken();
|
||||||
const userProfile = await getUserProfile(accessToken);
|
const userProfile = await getUserProfile(accessToken);
|
||||||
const userPhoto = await getUserPhoto(accessToken);
|
const userPhoto = await getUserPhoto(accessToken);
|
||||||
@@ -102,6 +101,8 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,20 +111,15 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
Object.keys(appContext.state.userProfile).length === 0
|
Object.keys(appContext.state.userProfile).length === 0
|
||||||
) {
|
) {
|
||||||
setUserProfile();
|
setUserProfile();
|
||||||
getPages();
|
|
||||||
}
|
}
|
||||||
}, [isAuthenticated]);
|
}, [isAuthenticated]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getPages();
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Navbar
|
<Navbar
|
||||||
handlePageClick={handlePageClick}
|
handlePageClick={handlePageClick}
|
||||||
handleSignIn={handleSignIn}
|
handleSignIn={handleSignIn}
|
||||||
isAuthenticated={isAuthenticated}
|
isAuthenticated={isAuthenticated}
|
||||||
logo={<Icon iconName={IconName.USER_TIE} size='2xl' />}
|
logo={<Icon iconName='fa-user-tie' size="2x" />}
|
||||||
pages={pages}
|
pages={pages}
|
||||||
settings={<Settings />}
|
settings={<Settings />}
|
||||||
userPhoto={userPhoto}
|
userPhoto={userPhoto}
|
||||||
@@ -9,6 +9,7 @@ const AppContextProvider = (
|
|||||||
props: AppContextProviderProps
|
props: AppContextProviderProps
|
||||||
) => {
|
) => {
|
||||||
const intialState: AppContextState = {
|
const intialState: AppContextState = {
|
||||||
|
featureFlags: [],
|
||||||
userProfile: {}
|
userProfile: {}
|
||||||
};
|
};
|
||||||
const [state, dispatch] = useReducer(reducer, intialState);
|
const [state, dispatch] = useReducer(reducer, intialState);
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { User } from '@microsoft/microsoft-graph-types';
|
import { User } from '@microsoft/microsoft-graph-types';
|
||||||
|
|
||||||
export interface AppContextState {
|
export interface AppContextState {
|
||||||
|
featureFlags: { key: string; enabled: boolean }[];
|
||||||
userProfile: User;
|
userProfile: User;
|
||||||
}
|
}
|
||||||
0
app2/src/index.css
Normal file
0
app2/src/index.css
Normal file
@@ -6,7 +6,6 @@ import { BrowserRouter } from 'react-router-dom';
|
|||||||
import { AuthenticationResult, EventMessage, EventType, PublicClientApplication } from '@azure/msal-browser';
|
import { AuthenticationResult, EventMessage, EventType, PublicClientApplication } from '@azure/msal-browser';
|
||||||
import { msalConfig } from './auth/msalConfig.ts';
|
import { msalConfig } from './auth/msalConfig.ts';
|
||||||
import AppContextProvider from './context/appContext/AppContextProvider.tsx';
|
import AppContextProvider from './context/appContext/AppContextProvider.tsx';
|
||||||
import './index.css';
|
|
||||||
|
|
||||||
const msalInstance: PublicClientApplication = new PublicClientApplication(msalConfig);
|
const msalInstance: PublicClientApplication = new PublicClientApplication(msalConfig);
|
||||||
|
|
||||||
212
data/profile/profile.json
Normal file
212
data/profile/profile.json
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
{
|
||||||
|
"experiences": [
|
||||||
|
{
|
||||||
|
"jobTitle": "Senior Software Engineer",
|
||||||
|
"company": "Sensonix, Inc.",
|
||||||
|
"location": "Plymouth, Minnesota",
|
||||||
|
"startDate": "April 2023",
|
||||||
|
"endDate": "Present",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "Senior Software Engineer",
|
||||||
|
"company": "Amano McGann, Inc.",
|
||||||
|
"location": "Roseville, Minnesota",
|
||||||
|
"startDate": "July 2022",
|
||||||
|
"endDate": "April 2023",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "Senior Software Engineer",
|
||||||
|
"company": "Optum",
|
||||||
|
"location": "Eden Prairie, Minnesota",
|
||||||
|
"startDate": "March 2021",
|
||||||
|
"endDate": "June 2022",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "Senior Software Engineer",
|
||||||
|
"company": "Target",
|
||||||
|
"location": "Minneapolis, Minnesota",
|
||||||
|
"startDate": "December 2018",
|
||||||
|
"endDate": "February 2021",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "Developer, Business Systems",
|
||||||
|
"company": "Minnesota Twins",
|
||||||
|
"location": "Minneapolis, Minnesota",
|
||||||
|
"startDate": "February 2017",
|
||||||
|
"endDate": "December 2018",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "SharePoint Administrator/Developer",
|
||||||
|
"company": "Minnesota Judicial Branch",
|
||||||
|
"location": "Saint Paul, Minnesota",
|
||||||
|
"startDate": "January 2016",
|
||||||
|
"endDate": "February 2017",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jobTitle": "Consultant",
|
||||||
|
"company": "Magenic Technologies",
|
||||||
|
"location": "Saint Louis Park, Minnesota",
|
||||||
|
"startDate": "August 2011",
|
||||||
|
"endDate": "January 2016",
|
||||||
|
"details": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"education": [
|
||||||
|
{
|
||||||
|
"school": "Metropolitan State University",
|
||||||
|
"location": "Saint Paul, Minnesota",
|
||||||
|
"degree": "Bachelor of Arts",
|
||||||
|
"fieldOfStudy": "Technical Communication"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"school": "Century College",
|
||||||
|
"location": "White Bear Lake, Minnesota",
|
||||||
|
"degree": "Associate of Arts",
|
||||||
|
"fieldOfStudy": "Liberal Arts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"about": {
|
||||||
|
"details": "\\# This is some markdown.",
|
||||||
|
"summary": null
|
||||||
|
},
|
||||||
|
"intro": {
|
||||||
|
"firstName": "Noah",
|
||||||
|
"lastName": "Spannbauer",
|
||||||
|
"photoUrl": null,
|
||||||
|
"title": "Senior Software Engineer",
|
||||||
|
"location": "Minneapolis, Minnesota, United States"
|
||||||
|
},
|
||||||
|
"skills": [
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Agile Methodologies",
|
||||||
|
"skills": [
|
||||||
|
"Scrum"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Containerization",
|
||||||
|
"skills": [
|
||||||
|
"Docker",
|
||||||
|
"Kubernetes",
|
||||||
|
"Helm"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Continuous Integration and Continuous Delivery",
|
||||||
|
"skills": [
|
||||||
|
"GitHub Actions",
|
||||||
|
"Argo CD"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Database",
|
||||||
|
"skills": [
|
||||||
|
"PostgreSQL"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Front-End Web Development",
|
||||||
|
"skills": [
|
||||||
|
"React",
|
||||||
|
"Node.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Infrastructure as Code",
|
||||||
|
"skills": [
|
||||||
|
"Terraform"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Messaging",
|
||||||
|
"skills": [
|
||||||
|
"RabbitMQ"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Programming Languages",
|
||||||
|
"skills": [
|
||||||
|
"JavaScript",
|
||||||
|
"Typescript"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Test Automation",
|
||||||
|
"skills": [
|
||||||
|
"Cucumber",
|
||||||
|
"Gherkin",
|
||||||
|
"Jest",
|
||||||
|
"Playwright"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Experienced",
|
||||||
|
"group": "Cloud",
|
||||||
|
"skills": [
|
||||||
|
"Amazon Web Services (AWS)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Cloud",
|
||||||
|
"skills": [
|
||||||
|
"Azure"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Continuous Integration and Continuous Delivery",
|
||||||
|
"skills": [
|
||||||
|
"Azure DevOps",
|
||||||
|
"Drone",
|
||||||
|
"Vela"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Database",
|
||||||
|
"skills": [
|
||||||
|
"MongoDB",
|
||||||
|
"SQL Server"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Messaging",
|
||||||
|
"skills": [
|
||||||
|
"Khafka"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Programming Languages",
|
||||||
|
"skills": [
|
||||||
|
"C#",
|
||||||
|
"Powershell"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category": "Familiar",
|
||||||
|
"group": "Test Automation",
|
||||||
|
"skills": [
|
||||||
|
"Cypress"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"___mb_schema": "/.mattrbld/schemas/Profile.json"
|
||||||
|
}
|
||||||
0
data/projects/.gitkeep
Normal file
0
data/projects/.gitkeep
Normal file
23
data/projects/projects.json
Normal file
23
data/projects/projects.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"projects": [
|
||||||
|
{
|
||||||
|
"repoName": "noahspan-components",
|
||||||
|
"title": "Components (React + Storybook)",
|
||||||
|
"iconName": "fa-puzzle-piece",
|
||||||
|
"summary": "A component library with custom React components, extended components from Material UI, and a subset of Font Awesome icons."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"repoName": "noahspan-flying",
|
||||||
|
"title": "Flying (React + Nest.js)",
|
||||||
|
"iconName": "fa-plane",
|
||||||
|
"summary": "A pilot logbook for logging flight hours."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"repoName": "noahspan-modules",
|
||||||
|
"title": "Modules (Nest.js)",
|
||||||
|
"iconName": "fa-gear",
|
||||||
|
"summary": "A library of custom modules for projects using Nest.js."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"___mb_schema": "/.mattrbld/schemas/Projects.json"
|
||||||
|
}
|
||||||
@@ -2,33 +2,10 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
azurite:
|
azurite:
|
||||||
container_name: azurite-root
|
container_name: azurite
|
||||||
image: mcr.microsoft.com/azure-storage/azurite:3.33.0
|
image: mcr.microsoft.com/azure-storage/azurite:3.33.0
|
||||||
ports:
|
ports:
|
||||||
- '10000:10000'
|
- '10000:10000'
|
||||||
- '10001:10001'
|
- '10001:10001'
|
||||||
- '10002:10002'
|
- '10002:10002'
|
||||||
command: 'azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose'
|
command: 'azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose'
|
||||||
volumes:
|
|
||||||
- ./azurite-root:/data
|
|
||||||
|
|
||||||
api:
|
|
||||||
container_name: root-api
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
target: api
|
|
||||||
ports:
|
|
||||||
- '3000:3000'
|
|
||||||
env_file:
|
|
||||||
- ./api/.env
|
|
||||||
|
|
||||||
app:
|
|
||||||
container_name: root-app
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
target: app
|
|
||||||
ports:
|
|
||||||
- '8080:8080'
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
azurite-root:
|
|
||||||
26
infrastructure/.terraform.lock.hcl
generated
26
infrastructure/.terraform.lock.hcl
generated
@@ -2,20 +2,20 @@
|
|||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/azurerm" {
|
provider "registry.terraform.io/hashicorp/azurerm" {
|
||||||
version = "4.26.0"
|
version = "3.104.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:Vdylhj5W0M+J62bOOdvVUlmGB7M5TfaNRcThdb8ydcc=",
|
"h1:SSBkZNrevDxOI6j9tVel7/BKX/5xaMYUqx4qhLvrjS4=",
|
||||||
"zh:0e381bace81028596d60e253bc320bf62d00ae2ec207d7c7e70cdbec5f543334",
|
"zh:01aa74b1e13c797b20407c37c683b945ffb24462bb39cdaddcf5b3297272c85a",
|
||||||
"zh:32c8cf70e476a4d0e0a2d4cb94b4a4e95c287c5972ca1e8c0f37dc629fbe31cb",
|
"zh:42c3a69ece44ed6dbd5145dadbdbde9a2e99c3dc0b5a0b28544fd68e796a755d",
|
||||||
"zh:568ebaa4c66fc668dc14c8ff323e47fc7b2ac3b5a5d9eec612de2b6a30164f4c",
|
"zh:48102182e71a10f8337828239d770953fb54e95c4f617a5a327316ba7d9c9aa5",
|
||||||
"zh:596c218810ffb85bc7224574b6ba6dbab9295bfa7490eac98c5ff88beae75710",
|
"zh:4c086420f1acc033b5901dc266721a38f43cbab43dedae149df3ccd8d1a3615d",
|
||||||
"zh:75a0e5b60f24684d62944714deb1c790b17c8d4acc93b5cdb45a8187d887b7f1",
|
"zh:634e3d701798d699f502c86d1ee591778fa0a46be81a220bd849c0389cd742f1",
|
||||||
"zh:7d2abea6ab66a08fed7d1ab8d4f3a8344fe7e2ac76d7409a3e40e8c066df6f22",
|
"zh:6aa0c6cb606dcd8efe90fb9fb872aa5406119264ce2819d8daf35c813e6ba2f7",
|
||||||
"zh:7f4db75991fd610b2c0306226e5e1916d4b633cdb0126bc78951dce2365b3418",
|
"zh:8604d0a159b1905d7a92448d5e2e1ec0b3275b9b2d8f7986f4a566f570a6f90c",
|
||||||
"zh:95fe307defb6e0dc172855fa597140f3da96655b3c558c140ae51a4a6077f58d",
|
"zh:912ddd9a43cbb168a58f1af625a8fe111e505c059442ad6126905449e5013877",
|
||||||
"zh:ae07cdd3c658c0e24d45f1cfadf8b085b18981bcd72a20093ce3f042ed0adf3f",
|
"zh:9ed54f1e7ae7881611ae659bfbd11db878adc77aa848b920cc0d76a1ab41a2ac",
|
||||||
"zh:d2a471b9e42499a7247f873aebd5cbc8df0c6691f02a5c9b556aa00045c06869",
|
"zh:b507020a566bdbc0dfe868103664361e8ee5549de6edceb7f5d6837dcd8af5a3",
|
||||||
"zh:e0299c0f6eae2b1c935f552f76fc49a2e61975eeda9410e3920a004b74d9e750",
|
|
||||||
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||||
|
"zh:f7fc6699a0359183911448bf9736777cd6d8ce91fd20d682cf635fa58e2905dd",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
locals {
|
|
||||||
name = {
|
|
||||||
test = "noahspan-test"
|
|
||||||
prod = "noahspan-prod"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_analytics_workspace_name = {
|
|
||||||
test = "noahspan-log-analytics-workspace-test"
|
|
||||||
prod = "noahspan-log-analytics-workspace-prod"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
output "name" {
|
|
||||||
value = local.name[var.environment]
|
|
||||||
}
|
|
||||||
|
|
||||||
output "log_analytics_workspace_name" {
|
|
||||||
value = local.log_analytics_workspace_name[var.environment]
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
variable "environment" {}
|
|
||||||
@@ -1,4 +1,61 @@
|
|||||||
module "container_app_environment" {
|
locals {
|
||||||
source = "./container_app_environment"
|
container_app_app_name = {
|
||||||
environment = var.environment
|
test = "root-app-test"
|
||||||
|
prod = "root-app-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_app_container_image = {
|
||||||
|
test = "noahspan/root-app:v0.0.1"
|
||||||
|
prod = "noahspan/root-app:v0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_app_container_name = {
|
||||||
|
test = "root-app-test"
|
||||||
|
prod = "root-app-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_api_name = {
|
||||||
|
test = "root-api-test"
|
||||||
|
prod = "root-api-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_api_container_image = {
|
||||||
|
test = "noahspan/root-api:v0.0.1"
|
||||||
|
prod = "noahspan/root-api:v0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_api_container_name = {
|
||||||
|
test = "root-api-test"
|
||||||
|
prod = "root-api-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_api_dapr_app_id = {
|
||||||
|
test = "rootapitest"
|
||||||
|
prod = "rootpapiprod"
|
||||||
|
}
|
||||||
|
|
||||||
|
container_app_environment_name = {
|
||||||
|
test = "root-test"
|
||||||
|
prod = "root-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
custom_domain_count = {
|
||||||
|
test = 0
|
||||||
|
prod = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log_analytics_workspace_name = {
|
||||||
|
test = "root-log-analytics-workspace-test"
|
||||||
|
prod = "root-log-analytics-workspace-prod"
|
||||||
|
}
|
||||||
|
|
||||||
|
storage_account_name = {
|
||||||
|
test = "noahspanroottest"
|
||||||
|
prod = "noahspanrootprod"
|
||||||
|
}
|
||||||
|
|
||||||
|
storage_tables = {
|
||||||
|
test = ["projects"]
|
||||||
|
prod = ["projects"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,47 @@
|
|||||||
output "container_app_environment" {
|
output "container_app_app_name" {
|
||||||
value = module.container_app_environment
|
value = local.container_app_app_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_app_container_image" {
|
||||||
|
value = local.container_app_app_container_image[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_app_container_name" {
|
||||||
|
value = local.container_app_app_container_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_api_name" {
|
||||||
|
value = local.container_app_api_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_api_container_image" {
|
||||||
|
value = local.container_app_api_container_image[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_api_container_name" {
|
||||||
|
value = local.container_app_api_container_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_api_dapr_app_id" {
|
||||||
|
value = local.container_app_api_dapr_app_id[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "container_app_environment_name" {
|
||||||
|
value = local.container_app_environment_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "custom_domain_count" {
|
||||||
|
value = local.custom_domain_count[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "log_analytics_workspace_name" {
|
||||||
|
value = local.log_analytics_workspace_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "storage_account_name" {
|
||||||
|
value = local.storage_account_name[var.environment]
|
||||||
|
}
|
||||||
|
|
||||||
|
output "storage_tables" {
|
||||||
|
value = local.storage_tables[var.environment]
|
||||||
}
|
}
|
||||||
0
infrastructure/container_apps.tf
Normal file
0
infrastructure/container_apps.tf
Normal file
@@ -1,40 +1,23 @@
|
|||||||
# module "storage" {
|
module "container_app" {
|
||||||
# source = "github.com/noahspannbauer/noahspan-terraform/modules/storage"
|
source = "github.com/noahspannbauer/noahspan-terraform/modules/container_app"
|
||||||
# resource_group_name = var.RESOURCE_GROUP_NAME
|
app_subdomain_name = var.APP_SUBDOMAIN_NAME
|
||||||
# static_websites = module.environment.static_websites
|
client_id = var.CLIENT_ID
|
||||||
# storage_account_name = module.environment.storage_account_name
|
client_secret = var.CLIENT_SECRET
|
||||||
# storage_blobs = module.environment.storage_blobs
|
container_app_app_name = module.environment.container_app_app_name
|
||||||
# storage_tables = module.environment.storage_tables
|
container_app_app_container_image = module.environment.container_app_api_container_image
|
||||||
# }
|
container_app_app_container_name = module.environment.container_app_api_container_name
|
||||||
|
container_app_api_name = module.environment.container_app_api_name
|
||||||
# module "container_app" {
|
container_app_api_container_image = module.environment.container_app_api_container_image
|
||||||
# source = "github.com/noahspannbauer/noahspan-terraform/modules/container_app"
|
container_app_api_container_name = module.environment.container_app_api_container_name
|
||||||
# app_subdomain_name = var.APP_SUBDOMAIN_NAME
|
container_app_environment_name = module.environment.container_app_environment_name
|
||||||
# client_id = var.CLIENT_ID
|
custom_domain_count = module.environment.custom_domain_count
|
||||||
# client_secret = var.CLIENT_SECRET
|
dns_zone_resource_group = var.DNS_ZONE_RESOURCE_GROUP
|
||||||
# container_app_app_name = module.environment.container_app_app_name
|
docker_io_password = var.DOCKER_IO_PASSWORD
|
||||||
# container_app_app_container_image = module.environment.container_app_api_container_image
|
docker_io_username = var.DOCKER_IO_USERNAME
|
||||||
# container_app_app_container_name = module.environment.container_app_api_container_name
|
domain_name = var.DOMAIN_NAME
|
||||||
# container_app_api_name = module.environment.container_app_api_name
|
log_analytics_workspace_name = module.environment.log_analytics_workspace_name
|
||||||
# container_app_api_container_image = module.environment.container_app_api_container_image
|
|
||||||
# container_app_api_container_name = module.environment.container_app_api_container_name
|
|
||||||
# container_app_environment_name = module.environment.container_app_environment_name
|
|
||||||
# custom_domain_count = module.environment.custom_domain_count
|
|
||||||
# dns_zone_resource_group = var.DNS_ZONE_RESOURCE_GROUP
|
|
||||||
# docker_io_password = var.DOCKER_IO_PASSWORD
|
|
||||||
# docker_io_username = var.DOCKER_IO_USERNAME
|
|
||||||
# domain_name = var.DOMAIN_NAME
|
|
||||||
# log_analytics_workspace_name = module.environment.log_analytics_workspace_name
|
|
||||||
# resource_group_name = var.RESOURCE_GROUP_NAME
|
|
||||||
# storage_account_primary_connection_string = module.storage.storage_account_primary_connection_string
|
|
||||||
# tenant_id = var.TENANT_ID
|
|
||||||
# }
|
|
||||||
|
|
||||||
module "container_app_environment" {
|
|
||||||
source = "github.com/noahspannbauer/noahspan-terraform/modules/container_app_environment"
|
|
||||||
container_app_environment_name = module.environment.container_app_environment.name
|
|
||||||
log_analytics_workspace_name = module.environment.container_app_environment.log_analytics_workspace_name
|
|
||||||
log_analytics_workspace_retention_in_days = 30
|
|
||||||
log_analytics_workspace_sku = "PerGB2018"
|
|
||||||
resource_group_name = var.RESOURCE_GROUP_NAME
|
resource_group_name = var.RESOURCE_GROUP_NAME
|
||||||
|
storage_account_name = module.environment.storage_account_name
|
||||||
|
storage_tables = module.environment.storage_tables
|
||||||
|
tenant_id = var.TENANT_ID
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
terraform {
|
terraform {
|
||||||
required_version = ">= 1.13.0"
|
required_version = ">= 1.1.0"
|
||||||
|
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
variable "APP_SUBDOMAIN_NAME" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "CLIENT_ID" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "CLIENT_SECRET" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "DNS_ZONE_RESOURCE_GROUP" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
variable "DOCKER_IO_PASSWORD" {
|
variable "DOCKER_IO_PASSWORD" {
|
||||||
type = string
|
type = string
|
||||||
sensitive = true
|
sensitive = true
|
||||||
@@ -7,6 +24,10 @@ variable "DOCKER_IO_USERNAME" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "DOMAIN_NAME" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
variable "RESOURCE_GROUP_NAME" {
|
variable "RESOURCE_GROUP_NAME" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|||||||
15
package.json
15
package.json
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@noahspan/noahspan-root",
|
"name": "noahspan-root",
|
||||||
"version": "1.1.0",
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
"preprod": "rimraf ./.prod && pnpm --filter api build && pnpm --filter app build",
|
|
||||||
"prod": "pnpm --filter api --prod deploy ./.prod/api && pnpm --filter app --prod deploy ./.prod/app"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"author": "",
|
||||||
"rimraf": "^6.0.1"
|
"license": "ISC"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
1540
pnpm-lock.yaml
generated
1540
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
|||||||
packages:
|
packages:
|
||||||
- 'api'
|
- 'api'
|
||||||
- 'app'
|
- 'app'
|
||||||
|
- 'app2'
|
||||||
Reference in New Issue
Block a user