* feat: implement Trello integration with OAuth and user fields * feat: migrate Trello integration to new integrations table * refactor: migrate Trello integration to use new integration system * refactor: migrate Trello integration to use new integrations table * fix: add loading check for Trello integration and update VSCode settings * feat: enhance import boards UI with dynamic integration providers and local storage config * feat: add select/unselect all buttons and loading state to board import form * feat: add Trello import env vars on README * docs: update Trello import guide to use OAuth flow instead of API keys * feat: add integrations table for OAuth token management * feat: connect trello from import modal * refactor: consolidate Trello integration endpoints into unified integration router * fix: trello import again * refactor: generalize integration authorization flow and improve error handling * refactor: update Trello API endpoints and tags for better organization * feat: add Integrations tag to OpenAPI specification * refactor: update Trello auth endpoint to use generic integration provider param * refactor: move Trello integration logic from trello.ts to import.ts router * refactor: consolidate Trello integration endpoints and fix API URL * chore: remove debug logs --------- Co-authored-by: Henry <henry_ball@hotmail.co.uk>
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { relations } from "drizzle-orm";
|
|
import {
|
|
pgTable,
|
|
primaryKey,
|
|
timestamp,
|
|
uuid,
|
|
varchar,
|
|
} from "drizzle-orm/pg-core";
|
|
|
|
import { users } from "./users";
|
|
|
|
export const integrations = pgTable(
|
|
"integration",
|
|
{
|
|
provider: varchar("provider", { length: 255 }).notNull(),
|
|
userId: uuid("userId")
|
|
.notNull()
|
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
accessToken: varchar("accessToken", { length: 255 }).notNull(),
|
|
refreshToken: varchar("refreshToken", { length: 255 }),
|
|
expiresAt: timestamp("expiresAt").notNull(),
|
|
createdAt: timestamp("createdAt")
|
|
.$defaultFn(() => new Date())
|
|
.notNull(),
|
|
updatedAt: timestamp("updatedAt").$onUpdateFn(() => new Date()),
|
|
},
|
|
(table) => [
|
|
primaryKey({
|
|
name: "integration_pkey",
|
|
columns: [table.userId, table.provider],
|
|
}),
|
|
],
|
|
).enableRLS();
|
|
|
|
export const integrationsRelations = relations(integrations, ({ one }) => ({
|
|
user: one(users, {
|
|
fields: [integrations.userId],
|
|
references: [users.id],
|
|
}),
|
|
}));
|