kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(api): create workflow rules for Gitea column migration

Tin 9e5a6a1d dcc75901

+14 -3
+14 -3
apps/api/src/migrations/column-migration.ts
··· 81 81 }); 82 82 83 83 for (const integration of integrations) { 84 - if (integration.type !== "github" || !integration.isActive) continue; 84 + if ( 85 + (integration.type !== "github" && integration.type !== "gitea") || 86 + !integration.isActive 87 + ) { 88 + continue; 89 + } 90 + 91 + const forgeType = integration.type as "github" | "gitea"; 85 92 86 93 try { 87 94 const config = JSON.parse(integration.config); ··· 96 103 97 104 await ensureMigrationWorkflowRule( 98 105 project.id, 106 + forgeType, 99 107 eventType as string, 100 108 targetColumnId, 101 109 ); ··· 108 116 if (todoColumnId) { 109 117 await ensureMigrationWorkflowRule( 110 118 project.id, 119 + forgeType, 111 120 "issue_opened", 112 121 todoColumnId, 113 122 ); ··· 116 125 if (doneColumnId) { 117 126 await ensureMigrationWorkflowRule( 118 127 project.id, 128 + forgeType, 119 129 "issue_closed", 120 130 doneColumnId, 121 131 ); ··· 135 145 136 146 async function ensureMigrationWorkflowRule( 137 147 projectId: string, 148 + integrationType: "github" | "gitea", 138 149 eventType: string, 139 150 columnId: string, 140 151 ) { 141 152 const existing = await db.query.workflowRuleTable.findFirst({ 142 153 where: and( 143 154 eq(workflowRuleTable.projectId, projectId), 144 - eq(workflowRuleTable.integrationType, "github"), 155 + eq(workflowRuleTable.integrationType, integrationType), 145 156 eq(workflowRuleTable.eventType, eventType), 146 157 ), 147 158 }); ··· 152 163 153 164 await db.insert(workflowRuleTable).values({ 154 165 projectId, 155 - integrationType: "github", 166 + integrationType, 156 167 eventType, 157 168 columnId, 158 169 });