© 2026 Hedgehog Software, LLC
export const ApprovalRequestTypePgEnum = pgEnum('approval_request_type', ['CREDIT_NOTE']);
export const approvalRequestsTable = pgTable('approval_requests', { id: uuid('id').default(sql`gen_random_uuid()`).primaryKey().notNull(), requestorId: integer('requestor_id').notNull().references(() => employeesTable.workerId), type: ApprovalRequestTypePgEnum('type').notNull(), approvalObjectId: uuid('approval_object_id').notNull(), status: ApprovalStatusPgEnum('status').notNull(), totalValue: integer('total_value').notNull(), currencyCode: text('currency_code').notNull(), });
export const insertApprovalRequest = async (approvalRequest: ApprovalRequestInput): Promise<ApprovalRequest> => { logger.info('Inserting approval request', { approvalRequest }); const insertedApprovalRequest = await db .insert(approvalRequestsTable).values({ ...approvalRequest, type: ApprovalRequestType.CREDIT_NOTE }).returning().then((res) => res[0]); logger.info('Inserted approval request', { insertedApprovalRequest }); return getApprovalRequest(insertedApprovalRequest.id) as Promise<ApprovalRequest>; };
ERROR: column \"type\" is of type approval_request_type but expression is of type text; Hint: You will need to rewrite or cast the expression.
'CREDIT_NOTE'