init Project ✌️✌️
This commit is contained in:
commit
8a6dc19bdd
42 changed files with 249179 additions and 0 deletions
3
README.md
Normal file
3
README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Taobin Recipe Manager
|
||||||
|
|
||||||
|
### Mono Repo Clinet / Server Recipe Management project
|
||||||
16
client/.editorconfig
Normal file
16
client/.editorconfig
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
42
client/.gitignore
vendored
Normal file
42
client/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
4
client/.vscode/extensions.json
vendored
Normal file
4
client/.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||||
|
"recommendations": ["angular.ng-template"]
|
||||||
|
}
|
||||||
20
client/.vscode/launch.json
vendored
Normal file
20
client/.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "ng serve",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: start",
|
||||||
|
"url": "http://localhost:4200/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ng test",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: test",
|
||||||
|
"url": "http://localhost:9876/debug.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
42
client/.vscode/tasks.json
vendored
Normal file
42
client/.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "start",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "test",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
27
client/README.md
Normal file
27
client/README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Client
|
||||||
|
|
||||||
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.2.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||||
|
|
||||||
|
## Further help
|
||||||
|
|
||||||
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||||
98
client/angular.json
Normal file
98
client/angular.json
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"client": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/client",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"maximumError": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"optimization": false,
|
||||||
|
"vendorChunk": true,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"namedChunks": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "client:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "client:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "client:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
"zone.js/testing"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12216
client/package-lock.json
generated
Normal file
12216
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
39
client/package.json
Normal file
39
client/package.json
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"name": "client",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@abacritt/angularx-social-login": "^2.1.0",
|
||||||
|
"@angular/animations": "^16.2.0",
|
||||||
|
"@angular/common": "^16.2.0",
|
||||||
|
"@angular/compiler": "^16.2.0",
|
||||||
|
"@angular/core": "^16.2.0",
|
||||||
|
"@angular/forms": "^16.2.0",
|
||||||
|
"@angular/platform-browser": "^16.2.0",
|
||||||
|
"@angular/platform-browser-dynamic": "^16.2.0",
|
||||||
|
"@angular/router": "^16.2.0",
|
||||||
|
"rxjs": "~7.8.0",
|
||||||
|
"tslib": "^2.3.0",
|
||||||
|
"zone.js": "~0.13.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "^16.2.2",
|
||||||
|
"@angular/cli": "~16.2.2",
|
||||||
|
"@angular/compiler-cli": "^16.2.0",
|
||||||
|
"@types/jasmine": "~4.3.0",
|
||||||
|
"jasmine-core": "~4.6.0",
|
||||||
|
"karma": "~6.4.0",
|
||||||
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
|
"karma-coverage": "~2.2.0",
|
||||||
|
"karma-jasmine": "~5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
|
"typescript": "~5.1.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
16
client/src/app/app-routing.module.ts
Normal file
16
client/src/app/app-routing.module.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
loadComponent: () =>
|
||||||
|
import('./features/home/home.component').then((m) => m.HomeComponent),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class AppRoutingModule {}
|
||||||
0
client/src/app/app.component.css
Normal file
0
client/src/app/app.component.css
Normal file
5
client/src/app/app.component.html
Normal file
5
client/src/app/app.component.html
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<app-layout-header></app-layout-header>
|
||||||
|
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
|
||||||
|
<app-layout-footer></app-layout-footer>
|
||||||
29
client/src/app/app.component.spec.ts
Normal file
29
client/src/app/app.component.spec.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(() => TestBed.configureTestingModule({
|
||||||
|
imports: [RouterTestingModule],
|
||||||
|
declarations: [AppComponent]
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have as title 'client'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app.title).toEqual('client');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(compiled.querySelector('.content span')?.textContent).toContain('client app is running!');
|
||||||
|
});
|
||||||
|
});
|
||||||
14
client/src/app/app.component.ts
Normal file
14
client/src/app/app.component.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import {
|
||||||
|
GoogleLoginProvider,
|
||||||
|
SocialAuthService,
|
||||||
|
} from '@abacritt/angularx-social-login';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
templateUrl: './app.component.html',
|
||||||
|
styleUrls: ['./app.component.css'],
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
title = 'Recipe Manager';
|
||||||
|
}
|
||||||
48
client/src/app/app.module.ts
Normal file
48
client/src/app/app.module.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import {
|
||||||
|
GoogleLoginProvider,
|
||||||
|
GoogleSigninButtonModule,
|
||||||
|
SocialAuthServiceConfig,
|
||||||
|
SocialLoginModule,
|
||||||
|
} from '@abacritt/angularx-social-login';
|
||||||
|
import { CoreModule } from './core/core.module';
|
||||||
|
import { FooterComponent } from './core/layout/footer.component';
|
||||||
|
import { HeaderComponent } from './core/layout/header.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [AppComponent],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FooterComponent,
|
||||||
|
HeaderComponent,
|
||||||
|
AppRoutingModule,
|
||||||
|
SocialLoginModule,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: 'SocialAuthServiceConfig',
|
||||||
|
useValue: {
|
||||||
|
autoLogin: false,
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
id: GoogleLoginProvider.PROVIDER_ID,
|
||||||
|
provider: new GoogleLoginProvider(
|
||||||
|
'250904650832-atnankrca4pvegjofnp24hmefjke4doq.apps.googleusercontent.com',
|
||||||
|
{
|
||||||
|
oneTapEnabled: true,
|
||||||
|
scopes: 'profile email',
|
||||||
|
prompt: 'select_account',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
} as SocialAuthServiceConfig,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
bootstrap: [AppComponent],
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
12
client/src/app/core/core.module.ts
Normal file
12
client/src/app/core/core.module.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [],
|
||||||
|
imports: [
|
||||||
|
CommonModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class CoreModule { }
|
||||||
9
client/src/app/core/layout/footer.component.html
Normal file
9
client/src/app/core/layout/footer.component.html
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<footer>
|
||||||
|
<div class="container">
|
||||||
|
<a class="logo-font" routerLink="/">conduit</a>
|
||||||
|
<span class="attribution">
|
||||||
|
© {{ today | date : "yyyy" }}. An interactive learning project from
|
||||||
|
<a href="https://thinkster.io">Thinkster</a>. Code licensed under MIT.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
14
client/src/app/core/layout/footer.component.ts
Normal file
14
client/src/app/core/layout/footer.component.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-layout-footer',
|
||||||
|
templateUrl: './footer.component.html',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
imports: [DatePipe, RouterLink],
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class FooterComponent {
|
||||||
|
today: number = Date.now();
|
||||||
|
}
|
||||||
3
client/src/app/core/layout/header.component.html
Normal file
3
client/src/app/core/layout/header.component.html
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div>
|
||||||
|
<h1>This is Header</h1>
|
||||||
|
</div>
|
||||||
8
client/src/app/core/layout/header.component.ts
Normal file
8
client/src/app/core/layout/header.component.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-layout-header',
|
||||||
|
templateUrl: './header.component.html',
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class HeaderComponent {}
|
||||||
0
client/src/app/features/home/home.component.css
Normal file
0
client/src/app/features/home/home.component.css
Normal file
7
client/src/app/features/home/home.component.html
Normal file
7
client/src/app/features/home/home.component.html
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<p>home works!</p>
|
||||||
|
<asl-google-signin-button
|
||||||
|
type="standard"
|
||||||
|
shape="pill"
|
||||||
|
text="signin_with"
|
||||||
|
size="large"
|
||||||
|
></asl-google-signin-button>
|
||||||
21
client/src/app/features/home/home.component.spec.ts
Normal file
21
client/src/app/features/home/home.component.spec.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { HomeComponent } from './home.component';
|
||||||
|
|
||||||
|
describe('HomeComponent', () => {
|
||||||
|
let component: HomeComponent;
|
||||||
|
let fixture: ComponentFixture<HomeComponent>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [HomeComponent]
|
||||||
|
});
|
||||||
|
fixture = TestBed.createComponent(HomeComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
23
client/src/app/features/home/home.component.ts
Normal file
23
client/src/app/features/home/home.component.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import {
|
||||||
|
GoogleSigninButtonModule,
|
||||||
|
SocialAuthService,
|
||||||
|
} from '@abacritt/angularx-social-login';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { AppModule } from 'src/app/app.module';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-home',
|
||||||
|
templateUrl: './home.component.html',
|
||||||
|
styleUrls: ['./home.component.css'],
|
||||||
|
imports: [GoogleSigninButtonModule],
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class HomeComponent implements OnInit {
|
||||||
|
constructor(private _authService: SocialAuthService) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this._authService.authState.subscribe((user) => {
|
||||||
|
console.log(user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
0
client/src/assets/.gitkeep
Normal file
0
client/src/assets/.gitkeep
Normal file
BIN
client/src/favicon.ico
Normal file
BIN
client/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
14
client/src/index.html
Normal file
14
client/src/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Client</title>
|
||||||
|
<base href="/" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||||
|
<script src="https://accounts.google.com/gsi/client" async></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
7
client/src/main.ts
Normal file
7
client/src/main.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
import { AppModule } from './app/app.module';
|
||||||
|
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||||
|
.catch(err => console.error(err));
|
||||||
1
client/src/styles.css
Normal file
1
client/src/styles.css
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/* You can add global styles to this file, and also import other style files */
|
||||||
14
client/tsconfig.app.json
Normal file
14
client/tsconfig.app.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
33
client/tsconfig.json
Normal file
33
client/tsconfig.json
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"outDir": "./dist/out-tsc",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": false,
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"lib": [
|
||||||
|
"ES2022",
|
||||||
|
"dom"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
}
|
||||||
|
}
|
||||||
14
client/tsconfig.spec.json
Normal file
14
client/tsconfig.spec.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
10
recipe_manager.code-workspace
Normal file
10
recipe_manager.code-workspace
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "./client"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./server"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
47
server/data/data.go
Normal file
47
server/data/data.go
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func readFile() map[string]interface{} {
|
||||||
|
file, err := os.Open("data/data.json")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error when open file: %s", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
var data map[string]interface{}
|
||||||
|
|
||||||
|
err = json.NewDecoder(file).Decode(&data)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error when decode file: %s", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
recipe map[string]interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewData() *Data {
|
||||||
|
return &Data{
|
||||||
|
recipe: readFile(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Data) GetRecipe() map[string]interface{} {
|
||||||
|
return d.recipe
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Data) GetRecipe01() []interface{} {
|
||||||
|
return d.recipe["Recipe01"].([]interface{})
|
||||||
|
}
|
||||||
236126
server/data/data.json
Normal file
236126
server/data/data.json
Normal file
File diff suppressed because one or more lines are too long
5
server/go.mod
Normal file
5
server/go.mod
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
module recipe-manager
|
||||||
|
|
||||||
|
go 1.21.1
|
||||||
|
|
||||||
|
require github.com/go-chi/chi/v5 v5.0.10
|
||||||
2
server/go.sum
Normal file
2
server/go.sum
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
|
||||||
|
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
43
server/main.go
Normal file
43
server/main.go
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
s := NewServer(3000)
|
||||||
|
|
||||||
|
serverCtx, serverStopCtx := context.WithCancel(context.Background())
|
||||||
|
sig := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||||
|
go func() {
|
||||||
|
<-sig
|
||||||
|
|
||||||
|
shutdownCtx, _ := context.WithTimeout(serverCtx, 30*time.Second)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-shutdownCtx.Done()
|
||||||
|
if shutdownCtx.Err() == context.DeadlineExceeded {
|
||||||
|
log.Println("Shutdown timeout, force exit")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
err := s.Shutdown(shutdownCtx)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
serverStopCtx()
|
||||||
|
}()
|
||||||
|
|
||||||
|
err := s.Run()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
<-serverCtx.Done()
|
||||||
|
}
|
||||||
68
server/models/recipe.go
Normal file
68
server/models/recipe.go
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Recipe struct {
|
||||||
|
Timestamps string `json:"timestamps"`
|
||||||
|
MachineSetting MatchineSetting `json:"MachineSetting"`
|
||||||
|
Recipe01 []Recipe01 `json:"Recipe01"`
|
||||||
|
Topping Topping `json:"Topping"`
|
||||||
|
MaterailCode []MaterailCode `json:"MaterailCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MatchineSetting struct {
|
||||||
|
RecipeTag string `json:"RecipeTag"`
|
||||||
|
StrTextShowError []string `json:"strTextShowError"`
|
||||||
|
ConfigNumber int `json:"configNumber"`
|
||||||
|
TemperatureMax int `json:"temperatureMax"`
|
||||||
|
TemperatureMin int `json:"temperatureMin"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MaterailCode struct {
|
||||||
|
PackageDescription string `json:"PackageDescription"`
|
||||||
|
RefillValuePerStep int `json:"RefillValuePerStep"`
|
||||||
|
MaterialID int `json:"materialID"`
|
||||||
|
MaterialCode string `json:"materialCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// export interface MaterialSetting {
|
||||||
|
// AlarmIDWhenOffline: number;
|
||||||
|
// BeanChannel: boolean;
|
||||||
|
// CanisterType?: string;
|
||||||
|
// DrainTimer: number;
|
||||||
|
// IsEquipment: boolean;
|
||||||
|
// LeavesChannel: boolean;
|
||||||
|
// LowToOffline: number;
|
||||||
|
// MaterialDescrption?: string;
|
||||||
|
// MaterialStatus: number;
|
||||||
|
// PowderChannel: boolean;
|
||||||
|
// RefillUnitGram: boolean;
|
||||||
|
// RefillUnitMilliliters: boolean;
|
||||||
|
// RefillUnitPCS: boolean;
|
||||||
|
// ScheduleDrainType: number;
|
||||||
|
// SodaChannel: boolean;
|
||||||
|
// StockAdjust: number;
|
||||||
|
// StrTextShowError: string[];
|
||||||
|
// SyrupChannel: boolean;
|
||||||
|
// id: number;
|
||||||
|
// idAlternate: number;
|
||||||
|
// isUse: boolean;
|
||||||
|
// materialOtherName: string;
|
||||||
|
// materialName: string;
|
||||||
|
// pathOtherName?: string;
|
||||||
|
// pay_rettry_max_count: number;
|
||||||
|
// RawMaterialUnit?: string;
|
||||||
|
// RawMaterialData?: RawMaterialDatum[];
|
||||||
|
// MaterialComment?: string;
|
||||||
|
// MaterialStatusLastUpdate?: string;
|
||||||
|
// feed_mode?: string;
|
||||||
|
// MaterialParameter?: string;
|
||||||
|
// }
|
||||||
|
|
||||||
|
type MaterialSetting struct {
|
||||||
|
AlarmIDWhenOffline int `json:"AlarmIDWhenOffline"`
|
||||||
|
BeanChannel bool `json:"BeanChannel"`
|
||||||
|
CanisterType string `json:"CanisterType"`
|
||||||
|
DrainTimer int `json:"DrainTimer"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Recipe01 struct{}
|
||||||
|
type Topping struct{}
|
||||||
28
server/routers/recipe.go
Normal file
28
server/routers/recipe.go
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
package routers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"recipe-manager/data"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RecipeRouter struct {
|
||||||
|
data *data.Data
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRecipeRouter(data *data.Data) *RecipeRouter {
|
||||||
|
return &RecipeRouter{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rr *RecipeRouter) Route(r *chi.Mux) {
|
||||||
|
r.Route("/recipes", func(r chi.Router) {
|
||||||
|
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
json.NewEncoder(w).Encode(rr.data.GetRecipe())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
51
server/server.go
Normal file
51
server/server.go
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"recipe-manager/data"
|
||||||
|
"recipe-manager/routers"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
server *http.Server
|
||||||
|
data *data.Data
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServer(port uint) *Server {
|
||||||
|
return &Server{
|
||||||
|
server: &http.Server{Addr: fmt.Sprintf(":%d", port)},
|
||||||
|
data: data.NewData(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) Run() error {
|
||||||
|
|
||||||
|
s.server.Handler = createHandler()
|
||||||
|
log.Printf("Server running on %s", s.server.Addr)
|
||||||
|
return s.server.ListenAndServe()
|
||||||
|
}
|
||||||
|
|
||||||
|
func createHandler() http.Handler {
|
||||||
|
r := chi.NewRouter()
|
||||||
|
|
||||||
|
rr := routers.NewRecipeRouter(data.NewData())
|
||||||
|
rr.Route(r)
|
||||||
|
|
||||||
|
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
json.NewEncoder(w).Encode(map[string]string{"message": fmt.Sprintf("path %s are not exits", r.RequestURI)})
|
||||||
|
})
|
||||||
|
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) Shutdown(ctx context.Context) error {
|
||||||
|
return s.server.Shutdown(ctx)
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue