-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b669b0a
commit 52ce908
Showing
108 changed files
with
4,031 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/src/db/migrations/20241209233334_app-connection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Knex } from "knex"; | ||
|
||
import { TableName } from "@app/db/schemas"; | ||
import { createOnUpdateTrigger, dropOnUpdateTrigger } from "@app/db/utils"; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
if (!(await knex.schema.hasTable(TableName.AppConnection))) { | ||
await knex.schema.createTable(TableName.AppConnection, (t) => { | ||
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid()); | ||
t.string("name", 32).notNullable(); | ||
t.string("app").notNullable(); | ||
t.string("method").notNullable(); | ||
t.binary("encryptedCredentials").notNullable(); | ||
t.integer("version").defaultTo(1).notNullable(); | ||
t.uuid("orgId").notNullable(); | ||
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE"); | ||
t.timestamps(true, true, true); | ||
}); | ||
} | ||
|
||
await createOnUpdateTrigger(knex, TableName.AppConnection); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.dropTableIfExists(TableName.AppConnection); | ||
await dropOnUpdateTrigger(knex, TableName.AppConnection); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Code generated by automation script, DO NOT EDIT. | ||
// Automated by pulling database and generating zod schema | ||
// To update. Just run npm run generate:schema | ||
// Written by akhilmhdh. | ||
|
||
import { z } from "zod"; | ||
|
||
import { zodBuffer } from "@app/lib/zod"; | ||
|
||
import { TImmutableDBKeys } from "./models"; | ||
|
||
export const AppConnectionsSchema = z.object({ | ||
id: z.string().uuid(), | ||
name: z.string(), | ||
app: z.string(), | ||
method: z.string(), | ||
encryptedCredentials: zodBuffer, | ||
version: z.number().default(1), | ||
orgId: z.string().uuid(), | ||
createdAt: z.date(), | ||
updatedAt: z.date() | ||
}); | ||
|
||
export type TAppConnections = z.infer<typeof AppConnectionsSchema>; | ||
export type TAppConnectionsInsert = Omit<z.input<typeof AppConnectionsSchema>, TImmutableDBKeys>; | ||
export type TAppConnectionsUpdate = Partial<Omit<z.input<typeof AppConnectionsSchema>, TImmutableDBKeys>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum AppConnection { | ||
GitHub = "github", | ||
AWS = "aws" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { TAwsConnection } from "@app/lib/app-connections/aws/aws-connection-types"; | ||
import { TGitHubConnection, TGitHubConnectionInput } from "@app/lib/app-connections/github"; | ||
import { DiscriminativePick } from "@app/lib/types"; | ||
|
||
import { AppConnection } from "./app-connection-enums"; | ||
|
||
export type AppConnectionListItem = { | ||
app: AppConnection; | ||
name: string; | ||
methods: string[]; | ||
}; | ||
|
||
export type TAppConnection = { id: string } & (TAwsConnection | TGitHubConnection); | ||
|
||
export type TAppConnectionInput = { id: string } & (TAwsConnection | TGitHubConnectionInput); | ||
|
||
export type TCreateAppConnectionDTO = Pick<TAppConnectionInput, "credentials" | "method" | "name" | "app">; | ||
|
||
export type TUpdateAppConnectionDTO = Partial<Omit<TCreateAppConnectionDTO, "method" | "app">> & { | ||
connectionId: string; | ||
}; | ||
|
||
export type TAppConnectionConfig = { orgId: string } & DiscriminativePick< | ||
TAppConnectionInput, | ||
"app" | "method" | "credentials" | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum AwsConnectionMethod { | ||
AssumeRole = "assume-role", | ||
AccessKey = "access-key" | ||
} |
Oops, something went wrong.