-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from VernissageApp/feature/archive-request-ac…
…tions #163 Add controller for archives
- Loading branch information
Showing
6 changed files
with
221 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export enum ArchiveStatus { | ||
New = 'new', | ||
Processing = 'processing', | ||
Ready = 'ready', | ||
Expired = 'expired', | ||
Error = 'error' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ArchiveStatus } from "./archive-status"; | ||
import { User } from "./user"; | ||
|
||
export class Archive { | ||
public id = ''; | ||
public user?: User; | ||
public requestDate?: Date; | ||
public startDate?: Date; | ||
public endDate?: Date; | ||
public fileName?: string; | ||
public status?: ArchiveStatus; | ||
public errorMessage?: string; | ||
public createdAt?: Date; | ||
public updatedAt?: Date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { firstValueFrom } from 'rxjs'; | ||
import { WindowService } from '../common/window.service'; | ||
import { Archive } from 'src/app/models/archive'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ArchivesService { | ||
constructor(private httpClient: HttpClient, private windowService: WindowService) { | ||
} | ||
|
||
public async get(): Promise<Archive[]> { | ||
const event$ = this.httpClient.get<Archive[]>(this.windowService.apiUrl() + '/api/v1/archives'); | ||
return await firstValueFrom(event$); | ||
} | ||
|
||
public async create(): Promise<Archive> { | ||
const event$ = this.httpClient.post<Archive>(this.windowService.apiUrl() + '/api/v1/archives', null); | ||
return await firstValueFrom(event$); | ||
} | ||
} |