feat: import prepared Catalog bindings through authenticated services
This commit is contained in:
@@ -273,6 +273,7 @@ interface CatalogSyncEventTable {
|
||||
}
|
||||
|
||||
export interface CatalogDatabase {
|
||||
installationBindingImports: { workspaceId: string; databaseId: string; createdAt: Generated<Date> };
|
||||
workspaceDatabases: WorkspaceDatabaseTable;
|
||||
databaseBindings: DatabaseBindingTable;
|
||||
catalogTables: CatalogTableTable;
|
||||
@@ -681,10 +682,11 @@ export class KyselyCatalogRepository implements CatalogRepository {
|
||||
}, row.updatedAt === null ? null : new Date(row.updatedAt).toISOString());
|
||||
}
|
||||
|
||||
async create(input: DatabaseConfigurationInput): Promise<WorkspaceDatabase> {
|
||||
async create(input: DatabaseConfigurationInput, creationId?: string): Promise<WorkspaceDatabase> {
|
||||
try {
|
||||
return await this.db.transaction().execute(async (trx) => {
|
||||
const id = randomUUID();
|
||||
const id = creationId ?? randomUUID();
|
||||
if (creationId) await trx.insertInto("installationBindingImports").values({ workspaceId: input.workspaceId, databaseId: id }).execute();
|
||||
await trx.insertInto("workspaceDatabases").values({
|
||||
id,
|
||||
workspaceId: input.workspaceId,
|
||||
|
||||
Reference in New Issue
Block a user