mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-21 23:37:55 +00:00
27 lines
612 B
TypeScript
27 lines
612 B
TypeScript
import { getClient } from "../../client";
|
|
import { User } from "./../user";
|
|
import { Workspace } from "./../workspace";
|
|
|
|
export class Database {
|
|
constructor(
|
|
public id: number,
|
|
public name: string,
|
|
public workspace: Workspace
|
|
) {}
|
|
}
|
|
|
|
export async function createDatabase(
|
|
user: User,
|
|
databaseName: string,
|
|
workspace: Workspace
|
|
): Promise<Database> {
|
|
const response: any = await getClient(user).post(
|
|
`applications/workspace/${workspace.id}/`,
|
|
{
|
|
name: databaseName,
|
|
type: "database",
|
|
}
|
|
);
|
|
return new Database(response.data.id, response.data.name, workspace);
|
|
}
|