mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove expired room
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Result } from 'neverthrow';
|
||||
import { IActionsRepository } from 'src/app/core/actions/repository/actionsRepository';
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter'
|
||||
import { HttpResult } from 'src/app/infra/http/type';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ActionsRepositoryService implements IActionsRepository {
|
||||
|
||||
|
||||
private readonly baseUrl = '/api/v2/PresidentialActions';
|
||||
|
||||
constructor(
|
||||
private HttpAdapter: HttpAdapter
|
||||
) {}
|
||||
|
||||
// POST /api/v2/PresidentialActions
|
||||
async createPresidentialAction(body: any): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}`;
|
||||
return this.HttpAdapter.post<any>(url, body);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions
|
||||
async getPresidentialActions(): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions/{processId}
|
||||
async getPresidentialActionById(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// DELETE /api/v2/PresidentialActions/{processId}
|
||||
async deletePresidentialAction(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.delete<any>(url);
|
||||
}
|
||||
|
||||
// PUT /api/v2/PresidentialActions/{processId}
|
||||
async updatePresidentialAction(processId: number, body: any): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.put<any>(url, body);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions/{processId}/Posts
|
||||
async getPostsByProcessId(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}/Posts`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// DELETE /api/v2/PresidentialActions/{processId}/Posts/{documentId}
|
||||
async deletePostByDocumentId(processId: number, documentId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}/Posts/${documentId}`;
|
||||
return this.HttpAdapter.delete<any>(url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user