Skip to content

Commit

Permalink
refactor: Breakdown modules (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender authored Oct 1, 2024
1 parent 5d80e6e commit 24ba725
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 56 deletions.
8 changes: 4 additions & 4 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@angular/router": "18.2.6",
"@angular/service-worker": "18.2.6",
"@ctrl/tinycolor": "4.1.0",
"@ng-matero/extensions": "18.2.1",
"@ng-matero/extensions": "18.2.2",
"chart.js": "4.4.4",
"chartjs-adapter-date-fns": "3.0.0",
"chartjs-plugin-annotation": "3.0.1",
Expand Down
29 changes: 2 additions & 27 deletions client/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import { NgModule } from '@angular/core';
import { BrowserModule, } from '@angular/platform-browser';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import {
provideHttpClient,
withInterceptorsFromDi
} from '@angular/common/http';

import {
ErrorStateMatcher,
ShowOnDirtyErrorStateMatcher
} from '@angular/material/core';

import { MatToolbarModule } from '@angular/material/toolbar';

// services (global)
import { ApiService } from './services/api.service';
import { UserService } from './services/user.service';
import { UtilityService } from './services/utility.service';

// component
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
Expand All @@ -39,17 +24,7 @@ import { AppRoutingModule } from './app-routing.module';
// Application
AppRoutingModule
],
providers: [
ApiService,
{
provide: ErrorStateMatcher,
useClass: ShowOnDirtyErrorStateMatcher
},
provideHttpClient(withInterceptorsFromDi()),

UserService,
UtilityService
],
providers: [],
bootstrap: [
AppComponent
]
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/components/picker/settings.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from '@angular/core';

import { CommonModule } from '@angular/common';
import { NgIf, NgFor, NgStyle } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { MatButtonModule } from '@angular/material/button';
Expand Down Expand Up @@ -33,7 +33,7 @@ import { PickConfigComponent } from './pick-config.component';
],
bootstrap: [],
imports: [
CommonModule,
NgIf, NgFor, NgStyle,
FormsModule,
MatButtonModule,
MatCheckboxModule,
Expand Down
25 changes: 20 additions & 5 deletions client/src/app/pages/chart/chart.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgIf } from '@angular/common';

import {
provideHttpClient,
withInterceptorsFromDi
} from '@angular/common/http';

import {
ErrorStateMatcher,
ShowOnDirtyErrorStateMatcher
} from '@angular/material/core';

import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
Expand All @@ -8,8 +18,8 @@ import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';

// services
import { ApiService } from '../../services/api.service';
import { ChartService } from '../../services/chart.service';
import { ChartConfigService } from '../../services/config.service';

// component
import { ChartComponent } from './chart.component';
Expand All @@ -26,7 +36,7 @@ import { ChartRoutingModule } from './chart-routing.module';
ChartComponent
],
imports: [
CommonModule,
NgIf,
ChartRoutingModule,
MatButtonModule,
MatDialogModule,
Expand All @@ -35,8 +45,13 @@ import { ChartRoutingModule } from './chart-routing.module';
MatTooltipModule
],
providers: [
ChartService,
ChartConfigService
ApiService,
{
provide: ErrorStateMatcher,
useClass: ShowOnDirtyErrorStateMatcher
},
provideHttpClient(withInterceptorsFromDi()),
ChartService
]
})
export class ChartModule { }
11 changes: 3 additions & 8 deletions client/src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http
import { Observable } from 'rxjs/internal/Observable';
import { env } from '../../environments/environment';

import {
ChartDataset,
ScatterDataPoint
} from 'chart.js';

import {
IndicatorListing,
IndicatorParam,
IndicatorResult,
IndicatorResultConfig,
IndicatorSelection
} from '../pages/chart/chart.models';

@Injectable()
@Injectable({
providedIn: 'root'
})
export class ApiService {

constructor(
Expand Down
8 changes: 3 additions & 5 deletions client/src/app/services/chart.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/internal/Observable';

import {
BarController,
BarElement,
CategoryScale,
Chart,
ChartData,
ChartDataset,
Expand Down Expand Up @@ -37,7 +35,6 @@ import AnnotationPlugin, {
Chart.register(

// controllers
BarController,
CandlestickController,
LineController,
Tooltip,
Expand All @@ -53,7 +50,6 @@ Chart.register(
Filler,

// scales
CategoryScale,
LinearScale,
TimeSeriesScale
);
Expand All @@ -75,7 +71,9 @@ import { ApiService } from './api.service';
import { ChartConfigService } from './config.service';
import { UtilityService } from './utility.service';

@Injectable()
@Injectable({
providedIn: 'root'
})
export class ChartService {

listings: IndicatorListing[] = [];
Expand Down
6 changes: 4 additions & 2 deletions client/src/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ChartDataset,
ChartOptions,
FontSpec,
ScaleOptions,
ScaleOptions
} from 'chart.js';

// plugins
Expand All @@ -26,7 +26,9 @@ import {
ScaleValue
} from 'chartjs-plugin-annotation';

@Injectable()
@Injectable({
providedIn: 'root'
})
export class ChartConfigService {

constructor(
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/services/user.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import { UserSettings } from '../pages/chart/chart.models';

@Injectable()
@Injectable({
providedIn: 'root'
})
export class UserService {

settings: UserSettings; // initialized in app.component.ts
Expand Down
2 changes: 1 addition & 1 deletion server/Functions/Functions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Alpaca.Markets" Version="7.1.0" />
<PackageReference Include="Alpaca.Markets" Version="7.1.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.0" />
Expand Down

0 comments on commit 24ba725

Please sign in to comment.