Move in progress apps temporarily
This commit is contained in:
parent
ba04aa108c
commit
6eaaf8e9be
360 changed files with 6171 additions and 55 deletions
50
fix/metamigo-db/records/webhooks.ts
Normal file
50
fix/metamigo-db/records/webhooks.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import {
|
||||
RepositoryBase,
|
||||
recordInfo,
|
||||
UUID,
|
||||
Flavor,
|
||||
} from "common";
|
||||
|
||||
/*
|
||||
* Webhook
|
||||
*
|
||||
* A webhook allows external services to be notified when a recorded call is available
|
||||
*/
|
||||
|
||||
export type WebhookId = Flavor<UUID, "Webhook Id">;
|
||||
|
||||
export interface HttpHeaders {
|
||||
header: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface UnsavedWebhook {
|
||||
name: string;
|
||||
voiceLineId: string;
|
||||
endpointUrl: string;
|
||||
httpMethod: "post" | "put";
|
||||
headers?: HttpHeaders[];
|
||||
}
|
||||
|
||||
export interface SavedWebhook extends UnsavedWebhook {
|
||||
id: WebhookId;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export const WebhookRecord = recordInfo<UnsavedWebhook, SavedWebhook>(
|
||||
"app_public",
|
||||
"webhooks"
|
||||
);
|
||||
|
||||
export class WebhookRecordRepository extends RepositoryBase(WebhookRecord) {
|
||||
async findAllByBackendId(
|
||||
backendType: string,
|
||||
backendId: string
|
||||
): Promise<SavedWebhook[]> {
|
||||
return this.db.any(
|
||||
"select * from $1 where backend_type = $2 and backend_id = $3",
|
||||
[this.schemaTable, backendType, backendId]
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue