Fix typos and date type
All checks were successful
Java CI with Maven / build (push) Successful in 50s

This commit is contained in:
Sebastian Böckelmann 2023-11-11 19:20:05 +01:00
parent 13a876c893
commit 0e07549a65
7 changed files with 162 additions and 67 deletions

View File

@ -3,11 +3,11 @@ package core.api.models.timemanager.history;
public class WorkingStatus {
private boolean missedSchedules;
private int activeTime;
private int activeMinutes;
public WorkingStatus(boolean missedSchedules, int activeTime) {
this.missedSchedules = missedSchedules;
this.activeTime = activeTime;
this.activeMinutes = activeTime;
}
public boolean isMissedSchedules() {
@ -18,11 +18,11 @@ public class WorkingStatus {
this.missedSchedules = missedSchedules;
}
public int getActiveTime() {
return activeTime;
public int getActiveMinutes() {
return activeMinutes;
}
public void setActiveTime(int activeTime) {
this.activeTime = activeTime;
public void setActiveMinutes(int activeMinutes) {
this.activeMinutes = activeMinutes;
}
}

View File

@ -3,6 +3,7 @@ README.md
api.module.ts
api/account.service.ts
api/api.ts
api/history.service.ts
api/login.service.ts
api/properties.service.ts
api/schedule.service.ts

View File

@ -3,6 +3,7 @@ import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
import { AccountService } from './api/account.service';
import { HistoryService } from './api/history.service';
import { LoginService } from './api/login.service';
import { PropertiesService } from './api/properties.service';
import { ScheduleService } from './api/schedule.service';

View File

@ -1,5 +1,7 @@
export * from './account.service';
import { AccountService } from './account.service';
export * from './history.service';
import { HistoryService } from './history.service';
export * from './login.service';
import { LoginService } from './login.service';
export * from './properties.service';
@ -12,4 +14,4 @@ export * from './taskgroup.service';
import { TaskgroupService } from './taskgroup.service';
export * from './users.service';
import { UsersService } from './users.service';
export const APIS = [AccountService, LoginService, PropertiesService, ScheduleService, TaskService, TaskgroupService, UsersService];
export const APIS = [AccountService, HistoryService, LoginService, PropertiesService, ScheduleService, TaskService, TaskgroupService, UsersService];

View File

@ -0,0 +1,144 @@
/**
* API Title
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
import { ScheduleStatus } from '../model/models';
import { SimpleStatusResponse } from '../model/models';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable({
providedIn: 'root'
})
export class HistoryService {
protected basePath = 'http://localhost:8080/api';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
public encoder: HttpParameterCodec;
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
}
if (typeof this.configuration.basePath !== 'string') {
if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === "object" && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
if (value == null) {
return httpParams;
}
if (typeof value === "object") {
if (Array.isArray(value)) {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}
} else {
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
httpParams, value[k], key != null ? `${key}.${k}` : k));
}
} else if (key != null) {
httpParams = httpParams.append(key, value);
} else {
throw Error("key may not be null if value is not object or array");
}
return httpParams;
}
/**
* get number of active minutes
* get number of worked minutes today
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public historyWorkingStatusGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleStatus>;
public historyWorkingStatusGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleStatus>>;
public historyWorkingStatusGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleStatus>>;
public historyWorkingStatusGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
let localVarHeaders = this.defaultHeaders;
let localVarCredential: string | undefined;
// authentication (API_TOKEN) required
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = [
'application/json'
];
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
}
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
let localVarHttpContext: HttpContext | undefined = options && options.context;
if (localVarHttpContext === undefined) {
localVarHttpContext = new HttpContext();
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.get<ScheduleStatus>(`${this.configuration.basePath}/history/workingStatus`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@ -22,7 +22,6 @@ import { BasicScheduleFieldInfo } from '../model/models';
import { ForgottenActivityRequest } from '../model/models';
import { ScheduleActivateInfo } from '../model/models';
import { ScheduleInfo } from '../model/models';
import { ScheduleStatus } from '../model/models';
import { SimpleStatusResponse } from '../model/models';
import { TaskScheduleStopResponse } from '../model/models';
@ -629,61 +628,6 @@ export class ScheduleService {
);
}
/**
* get number of active minutes
* get number of worked minutes today
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public schedulesStatusTodayGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleStatus>;
public schedulesStatusTodayGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleStatus>>;
public schedulesStatusTodayGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleStatus>>;
public schedulesStatusTodayGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
let localVarHeaders = this.defaultHeaders;
let localVarCredential: string | undefined;
// authentication (API_TOKEN) required
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = [
'application/json'
];
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
}
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
let localVarHttpContext: HttpContext | undefined = options && options.context;
if (localVarHttpContext === undefined) {
localVarHttpContext = new HttpContext();
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.get<ScheduleStatus>(`${this.configuration.basePath}/schedules/status/today`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* registers forgotten schedule
* Registers forgotten schedule

View File

@ -1,6 +1,6 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {
BasicScheduleEntityInfo,
BasicScheduleEntityInfo, HistoryService,
ScheduleInfo,
ScheduleService,
TaskOverviewInfo,
@ -26,17 +26,20 @@ export class DashboardComponent implements OnInit{
selectedTaskgroupID: number | undefined
@ViewChild('activeSchedule') activeScheduleComponent: ActiveScheduleComponent | undefined
constructor(private scheduleService: ScheduleService) {
constructor(private scheduleService: ScheduleService,
private historyService: HistoryService) {
}
ngOnInit() {
this.scheduleService.schedulesDateStartableGet(String(Date.now()), true).subscribe({
const date: Date = new Date();
console.log(date)
this.scheduleService.schedulesDateStartableGet(date.toISOString().split("T")[0], true).subscribe({
next: resp => {
this.schedules = resp;
}
})
this.scheduleService.schedulesStatusTodayGet().subscribe({
this.historyService.historyWorkingStatusGet().subscribe({
next: resp => {
this.workedMinutesToday = resp.activeMinutes;
this.missedSchedules = resp.missedSchedules;