479445f741
* Added isTest to TaskRun * TriggerTaskService now accepts isTest and adds it to TaskRun if set * Set the cliVersion and sdkVersion when indexing * Added a test page * Radio buttons are now circles and accept a ReactNode * The background of the code editor is now darker * WIP on the test task page * Improvements to the test page * Testing is working * Fix typo * Show the real isTest value in the runs table * Added a key to the outlet so it correctly resets all the state on the sub-route
65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
import type { RuntimeEnvironment } from "@trigger.dev/database";
|
|
import { prisma } from "~/db.server";
|
|
|
|
export type { RuntimeEnvironment };
|
|
|
|
export async function findEnvironmentByApiKey(apiKey: string) {
|
|
const environment = await prisma.runtimeEnvironment.findUnique({
|
|
where: {
|
|
apiKey,
|
|
},
|
|
include: {
|
|
project: true,
|
|
organization: true,
|
|
orgMember: true,
|
|
},
|
|
});
|
|
|
|
//don't return deleted projects
|
|
if (environment?.project.deletedAt !== null) {
|
|
return null;
|
|
}
|
|
|
|
return environment;
|
|
}
|
|
|
|
export async function findEnvironmentByPublicApiKey(apiKey: string) {
|
|
const environment = await prisma.runtimeEnvironment.findUnique({
|
|
where: {
|
|
pkApiKey: apiKey,
|
|
},
|
|
include: {
|
|
project: true,
|
|
organization: true,
|
|
orgMember: true,
|
|
},
|
|
});
|
|
|
|
//don't return deleted projects
|
|
if (environment?.project.deletedAt !== null) {
|
|
return null;
|
|
}
|
|
|
|
return environment;
|
|
}
|
|
|
|
export async function findEnvironmentById(id: string) {
|
|
const environment = await prisma.runtimeEnvironment.findUnique({
|
|
where: {
|
|
id,
|
|
},
|
|
include: {
|
|
project: true,
|
|
organization: true,
|
|
orgMember: true,
|
|
},
|
|
});
|
|
|
|
//don't return deleted projects
|
|
if (environment?.project.deletedAt !== null) {
|
|
return null;
|
|
}
|
|
|
|
return environment;
|
|
}
|