1
0
Files
yel-dspace-angular/src/app/admin/admin-notify-dashboard/models/admin-notify-message.model.ts
2024-01-08 18:04:49 +01:00

146 lines
3.1 KiB
TypeScript

import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
import { typedObject } from '../../../core/cache/builders/build-decorators';
import { ADMIN_NOTIFY_MESSAGE } from './admin-notify-message.resource-type';
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { GenericConstructor } from '../../../core/shared/generic-constructor';
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
import { Observable } from 'rxjs';
export enum QueueStatusMap {
QUEUE_STATUS_PROCESSED = 'notify-queue-status.processed',
QUEUE_STATUS_FAILED = 'notify-queue-status.processed',
QUEUE_STATUS_UNMAPPED_ACTION = 'notify-queue-status.unmapped_action',
QUEUE_STATUS_QUEUED_FOR_RETRY = 'notify-queue-status.queue_retry',
QUEUE_STATUS_PROCESSING = 'notify-queue-status.processing',
QUEUE_STATUS_QUEUED = 'notify-queue-status.queued',
QUEUE_STATUS_UNTRUSTED = 'notify-queue-status.untrusted',
}
/**
* A message that includes admin notify info
*/
@typedObject
@inheritSerialization(DSpaceObject)
export class AdminNotifyMessage extends DSpaceObject {
static type = ADMIN_NOTIFY_MESSAGE;
/**
* The type of the resource
*/
@excludeFromEquals
type = ADMIN_NOTIFY_MESSAGE;
/**
* The id of the message
*/
@autoserialize
id: string;
/**
* The type of the notification
*/
@autoserialize
coarNotifyType: string;
/**
* The type of the activity
*/
@autoserialize
activityStreamType: string;
/**
* The object the message reply to
*/
@autoserialize
inReplyTo: string;
/**
* The object the message relates to
*/
@autoserialize
object: string;
/**
* The context of the message
*/
@autoserialize
context: string;
/**
* The attempts of the queue
*/
@autoserialize
queueAttempts: number;
/**
* Timestamp of the last queue attempt
*/
@autoserialize
queueLastStartTime: string;
/**
* The type of the activity stream
*/
@autoserialize
origin: number | string;
/**
* The type of the activity stream
*/
@autoserialize
target: number | string;
/**
* The label for the status of the queue
*/
@autoserialize
queueStatusLabel: string;
/**
* The timeout of the queue
*/
@autoserialize
queueTimeout: string;
/**
* The status of the queue
*/
@autoserialize
queueStatus: number;
/**
* Thumbnail link used when browsing items with showThumbs config enabled.
*/
@autoserialize
thumbnail: string;
/**
* The observable pointing to the item itself
*/
@autoserialize
item: Observable<AdminNotifyMessage>;
/**
* The observable pointing to the access status of the item
*/
@autoserialize
accessStatus: Observable<AdminNotifyMessage>;
@deserialize
_links: {
self: {
href: string;
};
};
get self(): string {
return this._links.self.href;
}
getRenderTypes(): (string | GenericConstructor<ListableObject>)[] {
return [this.constructor as GenericConstructor<ListableObject>];
}
}