move audit models to red-domain
This commit is contained in:
parent
ade00d4e28
commit
d068d54568
@ -1,13 +1,12 @@
|
||||
import { Component, forwardRef, Injector, OnDestroy, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { AuditResponse, AuditSearchRequest, IAudit } from '@redaction/red-ui-http';
|
||||
import { Moment } from 'moment';
|
||||
import { applyIntervalConstraints } from '@utils/date-inputs-utils';
|
||||
import { DefaultListingServices, ListingComponent, LoadingService, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { auditCategoriesTranslations } from '../../translations/audit-categories-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { Audit } from '@models/audit.model';
|
||||
import { Audit, IAudit, IAuditResponse, IAuditSearchRequest } from '@red/domain';
|
||||
import { AuditService } from '../../services/audit.service';
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
@ -26,7 +25,7 @@ export class AuditScreenComponent extends ListingComponent<Audit> implements OnD
|
||||
filterForm: FormGroup;
|
||||
categories: string[] = [];
|
||||
userIds: Set<string>;
|
||||
logs: AuditResponse;
|
||||
logs: IAuditResponse;
|
||||
readonly tableColumnConfigs: TableColumnConfig<Audit>[] = [
|
||||
{ label: _('audit-screen.table-col-names.message') },
|
||||
{ label: _('audit-screen.table-col-names.date') },
|
||||
@ -94,7 +93,7 @@ export class AuditScreenComponent extends ListingComponent<Audit> implements OnD
|
||||
if (to) {
|
||||
to = to.clone().add(1, 'd');
|
||||
}
|
||||
const logsRequestBody: AuditSearchRequest = {
|
||||
const logsRequestBody: IAuditSearchRequest = {
|
||||
pageSize: PAGE_SIZE,
|
||||
page: page,
|
||||
category: category === this.ALL_CATEGORIES ? undefined : category,
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { GenericService, RequiredParam, Validate } from '@iqser/common-ui';
|
||||
import { AuditResponse, AuditSearchRequest, CategoryModel, IAudit } from '@redaction/red-ui-http';
|
||||
import { CategoryModel } from '@redaction/red-ui-http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { IAudit, IAuditResponse, IAuditSearchRequest } from '@red/domain';
|
||||
|
||||
@Injectable()
|
||||
export class AuditService extends GenericService<IAudit> {
|
||||
@ -14,7 +15,7 @@ export class AuditService extends GenericService<IAudit> {
|
||||
}
|
||||
|
||||
@Validate()
|
||||
searchAuditLog(@RequiredParam() body: AuditSearchRequest): Observable<AuditResponse> {
|
||||
searchAuditLog(@RequiredParam() body: IAuditSearchRequest): Observable<IAuditResponse> {
|
||||
return this._post(body, `${this._defaultModelPath}/search`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,3 +4,4 @@ export * from './lib/shared/types';
|
||||
export * from './lib/dossier-attributes';
|
||||
export * from './lib/users';
|
||||
export * from './lib/pages';
|
||||
export * from './lib/audit';
|
||||
|
||||
10
libs/red-domain/src/lib/audit/audit-search.request.ts
Normal file
10
libs/red-domain/src/lib/audit/audit-search.request.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export interface IAuditSearchRequest {
|
||||
readonly category?: string;
|
||||
readonly from?: string;
|
||||
readonly objectId?: string;
|
||||
readonly page?: number;
|
||||
readonly pageSize?: number;
|
||||
readonly requestingUserId?: string;
|
||||
readonly to?: string;
|
||||
readonly userId?: string;
|
||||
}
|
||||
9
libs/red-domain/src/lib/audit/audit.interface.ts
Normal file
9
libs/red-domain/src/lib/audit/audit.interface.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export interface IAudit {
|
||||
readonly category: string;
|
||||
readonly details?: unknown;
|
||||
readonly message: string;
|
||||
readonly objectId?: string;
|
||||
readonly recordDate: string;
|
||||
readonly recordId: string;
|
||||
readonly userId: string;
|
||||
}
|
||||
@ -1,14 +1,14 @@
|
||||
import { IAudit } from '@redaction/red-ui-http';
|
||||
import { IListable } from '@iqser/common-ui';
|
||||
import { IAudit } from './audit.interface';
|
||||
|
||||
export class Audit implements IAudit, IListable {
|
||||
readonly recordId?: number;
|
||||
readonly category?: string;
|
||||
readonly recordId: string;
|
||||
readonly category: string;
|
||||
readonly details?: unknown;
|
||||
readonly message?: string;
|
||||
readonly message: string;
|
||||
readonly objectId?: string;
|
||||
readonly recordDate: string;
|
||||
readonly userId?: string;
|
||||
readonly userId: string;
|
||||
|
||||
constructor(audit: IAudit) {
|
||||
this.category = audit.category;
|
||||
@ -21,7 +21,7 @@ export class Audit implements IAudit, IListable {
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
return this.recordDate;
|
||||
return this.recordId;
|
||||
}
|
||||
|
||||
get searchKey(): string {
|
||||
9
libs/red-domain/src/lib/audit/audit.response.ts
Normal file
9
libs/red-domain/src/lib/audit/audit.response.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { IAudit } from './audit.interface';
|
||||
import { List } from '@iqser/common-ui';
|
||||
|
||||
export interface IAuditResponse {
|
||||
data: List<IAudit>;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
totalHits?: number;
|
||||
}
|
||||
4
libs/red-domain/src/lib/audit/index.ts
Normal file
4
libs/red-domain/src/lib/audit/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './audit.model';
|
||||
export * from './audit.interface';
|
||||
export * from './audit.response';
|
||||
export * from './audit-search.request';
|
||||
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface IAudit {
|
||||
readonly category?: string;
|
||||
readonly details?: unknown;
|
||||
readonly message?: string;
|
||||
readonly objectId?: string;
|
||||
readonly recordDate: string;
|
||||
readonly recordId?: number;
|
||||
readonly userId?: string;
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { IAudit } from './audit';
|
||||
|
||||
export interface AuditResponse {
|
||||
data?: Array<IAudit>;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
totalHits?: number;
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface AuditSearchRequest {
|
||||
category?: string;
|
||||
from?: string;
|
||||
objectId?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
requestingUserId?: string;
|
||||
to?: string;
|
||||
userId?: string;
|
||||
}
|
||||
@ -1,8 +1,5 @@
|
||||
export * from './addRedactionRequest';
|
||||
export * from './approveRequest';
|
||||
export * from './audit';
|
||||
export * from './auditResponse';
|
||||
export * from './auditSearchRequest';
|
||||
export * from './categoryModel';
|
||||
export * from './cellRectangle';
|
||||
export * from './change';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user