mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
Merge pull request #596 from Hexastack/fix/ts-issue
fix: Minor ts issue in subscriber preupdate hook
This commit is contained in:
commit
af936a7747
@ -235,6 +235,19 @@ export default abstract class ChannelHandler<
|
||||
event: EventWrapper<any, any, N>,
|
||||
): Promise<AttachmentFile | undefined>;
|
||||
|
||||
/**
|
||||
* Fetch the subscriber profile data
|
||||
*
|
||||
* @deprecated
|
||||
* @param event - The message event received
|
||||
* @returns {Promise<Subscriber>} - The channel's response, otherwise an error
|
||||
*/
|
||||
async getUserData(
|
||||
event: EventWrapper<any, any, N>,
|
||||
): Promise<SubscriberCreateDto> {
|
||||
return await this.getSubscriberData(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the subscriber profile data
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Hexastack. All rights reserved.
|
||||
* Copyright © 2025 Hexastack. All rights reserved.
|
||||
*
|
||||
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
|
||||
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
|
||||
@ -82,6 +82,10 @@ export class SubscriberRepository extends BaseRepository<
|
||||
|
||||
const oldSubscriber = await this.findOne(criteria);
|
||||
|
||||
if (!oldSubscriber) {
|
||||
throw new Error('Something went wrong: subscriber does not exist');
|
||||
}
|
||||
|
||||
if (subscriberUpdates.assignedTo !== oldSubscriber?.assignedTo) {
|
||||
this.eventEmitter.emit(
|
||||
'hook:subscriber:assign',
|
||||
|
@ -31,7 +31,11 @@ export type AttachmentRef =
|
||||
url: string;
|
||||
};
|
||||
|
||||
export interface AttachmentPayload {
|
||||
/** IMPORTANT: No need to use generic type here */
|
||||
export interface AttachmentPayload<T extends AttachmentRef = AttachmentRef> {
|
||||
type: FileType;
|
||||
payload: AttachmentRef;
|
||||
payload: T;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export type WithUrl<A> = A & { url?: string };
|
||||
|
Loading…
Reference in New Issue
Block a user