29edcd3df9
* Side menu: selector title changed to project. Changed section headers and made it Slack + Discord * Added project settings page. Renaming is working * Added project.deletedAt column * Deleting projects WIP * Allow clearing the project from the session * Don’t load projects that are deleted * Improved the project selection logic * Clear the session project id when deleting a project * Deleting the last project in an org now works. The new project page doesn’t have the sidebar anymore. * Removed false code comment * Added the JobRun index back in, using Prisma. Otherwise it tries to remove it on each migration * Only return environments where the project isn’t deleted. This will block API calls * Do the project deletedAt check in code, not SQL * Made it clearer what the code does with a comment and applied the same logic to the public api key
29 lines
589 B
TypeScript
29 lines
589 B
TypeScript
import { PrismaClient } from "@trigger.dev/database";
|
|
import { prisma } from "~/db.server";
|
|
|
|
export class DeleteEndpointService {
|
|
#prismaClient: PrismaClient;
|
|
|
|
constructor(prismaClient: PrismaClient = prisma) {
|
|
this.#prismaClient = prismaClient;
|
|
}
|
|
|
|
public async call(id: string, userId: string): Promise<void> {
|
|
await this.#prismaClient.endpoint.update({
|
|
data: {
|
|
url: null,
|
|
},
|
|
where: {
|
|
id,
|
|
organization: {
|
|
members: {
|
|
some: {
|
|
userId,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
}
|
|
}
|