fix: uploading new workflow will refresh the update date
This commit is contained in:
		
							parent
							
								
									45c7be3d50
								
							
						
					
					
						commit
						ffb117d85d
					
				@ -4,11 +4,12 @@ import { db } from "@/db/db";
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
  snapshotType,
 | 
					  snapshotType,
 | 
				
			||||||
  workflowAPIType,
 | 
					  workflowAPIType,
 | 
				
			||||||
 | 
					  workflowTable,
 | 
				
			||||||
  workflowType,
 | 
					  workflowType,
 | 
				
			||||||
  workflowVersionTable,
 | 
					  workflowVersionTable,
 | 
				
			||||||
} from "@/db/schema";
 | 
					} from "@/db/schema";
 | 
				
			||||||
import { parseDataSafe } from "@/lib/parseDataSafe";
 | 
					import { parseDataSafe } from "@/lib/parseDataSafe";
 | 
				
			||||||
import { sql } from "drizzle-orm";
 | 
					import { eq, sql } from "drizzle-orm";
 | 
				
			||||||
import { NextResponse } from "next/server";
 | 
					import { NextResponse } from "next/server";
 | 
				
			||||||
import { z } from "zod";
 | 
					import { z } from "zod";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -132,6 +133,14 @@ export async function POST(request: Request) {
 | 
				
			|||||||
        })
 | 
					        })
 | 
				
			||||||
        .returning();
 | 
					        .returning();
 | 
				
			||||||
      version = data[0].version;
 | 
					      version = data[0].version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      await db
 | 
				
			||||||
 | 
					        .update(workflowTable)
 | 
				
			||||||
 | 
					        .set({
 | 
				
			||||||
 | 
					          updated_at: new Date(),
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        .where(eq(workflowTable.id, workflow_id))
 | 
				
			||||||
 | 
					        .returning();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      return NextResponse.json(
 | 
					      return NextResponse.json(
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user