0e919f56f2
* Alerts v1 * Encrypt alert webhook secrets and allow them to be generated by the server * Alert v1 UI * Remove unnecessary emails * Move to using `@react-email/components` * WIP slack alerts * More slack alerts WIP * Update pnpm lock after rebase * Finish implementing Slack alerts * Use a more error like emoji * New secondary variant for the segmented control * Added a simple checkbox style variant to storybook * Style tweak to the segmented control * UI improvements to the alert modal * Use searchable Select for alerts. Changed default variant for SegmentedControl * Secondary button now using secondary colour * segmented control style tweak * Improved the channel column in the alerts table * Updated logo-mono.png * Updated email styles * Email templates updated to new styles * Don’t log the decrypted secret * await enqueing the deployment alert when an index fails * await enqueing the timeout alert --------- Co-authored-by: James Ritchie <james@jamesritchie.co.uk> Co-authored-by: Matt Aitken <matt@mattaitken.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { OrganizationIntegration } from "@trigger.dev/database";
|
|
import { BaseService } from "./baseService.server";
|
|
import { WebClient } from "@slack/web-api";
|
|
import { env } from "~/env.server";
|
|
import { $transaction } from "~/db.server";
|
|
import { getSecretStore } from "~/services/secrets/secretStore.server";
|
|
import { generateFriendlyId } from "../friendlyIdentifiers";
|
|
import { OrgIntegrationRepository } from "~/models/orgIntegration.server";
|
|
|
|
export class CreateOrgIntegrationService extends BaseService {
|
|
public async call(
|
|
userId: string,
|
|
orgId: string,
|
|
serviceName: string,
|
|
code: string
|
|
): Promise<OrganizationIntegration | undefined> {
|
|
// Get the org
|
|
const org = await this._prisma.organization.findUnique({
|
|
where: {
|
|
id: orgId,
|
|
members: {
|
|
some: {
|
|
userId,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!org) {
|
|
throw new Error("Organization not found");
|
|
}
|
|
|
|
return OrgIntegrationRepository.createOrgIntegration(serviceName, code, org);
|
|
}
|
|
}
|