add: deploy new application action
This commit is contained in:
parent
d6ba4e7c5a
commit
47fbed74c5
|
@ -0,0 +1,39 @@
|
|||
"use server";
|
||||
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export type NewApplication = {
|
||||
serviceProvider: string;
|
||||
git: {
|
||||
repositoryId: number;
|
||||
repositoryName: string;
|
||||
branch: string;
|
||||
path: string;
|
||||
};
|
||||
autodeploy: boolean;
|
||||
env: {
|
||||
[key: string]: string;
|
||||
};
|
||||
name: string;
|
||||
};
|
||||
|
||||
export async function createApplication(app: NewApplication, workspace: string) {
|
||||
const application = await prisma.application.create({
|
||||
data: {
|
||||
name: app.name,
|
||||
autoDeploy: app.autodeploy,
|
||||
branch: app.git.branch,
|
||||
path: app.git.path,
|
||||
repositoryId: app.git.repositoryId.toString(),
|
||||
repository: app.git.repositoryName,
|
||||
serviceProvider: app.serviceProvider,
|
||||
Workspace: {
|
||||
connect: {
|
||||
slug: workspace
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return application;
|
||||
}
|
Loading…
Reference in New Issue