Skip to content

Convert models directory to TypeScript#1373

Merged
alexanmtz merged 4 commits into
masterfrom
copilot/convert-models-to-typescript
Feb 2, 2026
Merged

Convert models directory to TypeScript#1373
alexanmtz merged 4 commits into
masterfrom
copilot/convert-models-to-typescript

Conversation

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Description

Converted 24 JavaScript models to TypeScript following the established pattern in paymentRequestBalance.ts. All models now have proper type definitions, interfaces, and class-based structure while maintaining full backward compatibility.

Changes

  • Models converted: assign, coupon, history, label, member, offer, order, organization, paymentRequest, paymentRequestTransfer, payout, plan, planSchema, programminglanguage, project, projectProgrammingLanguage, role, task, taskSolution, transfer, type, user, wallet, walletOrder

  • Type pattern applied:

    export interface ModelAttributes {
      id: number
      field: string
      // ...
    }
    
    export type ModelCreationAttributes = Optional<ModelAttributes, 'id' | 'createdAt'>
    
    export default class Model extends Model<ModelAttributes, ModelCreationAttributes> {
      static initModel(sequelize: Sequelize): typeof Model { /* ... */ }
      static associate(models: any) { /* ... */ }
    }
  • Preserved: All hooks, associations, instance methods, and business logic unchanged

  • Foreign key handling: Foreign key columns are only included in model schemas when they were explicitly defined in the original JavaScript models. Columns managed solely through associations (via belongsTo, hasMany, etc.) are not duplicated in the schema definition, following Sequelize best practices.

  • Dependencies: Added @types/bcrypt for type support

Bug Fixes

Fixed foreign key column definitions that were incorrectly added during initial conversion:

  • Removed foreign keys from: assign, member, offer, taskSolution, order, paymentRequest, organization, task, plan (these were only defined through associations in original JS models)
  • Kept foreign keys in: paymentRequestTransfer, payout, transfer, project, wallet, walletOrder, history (these were explicitly defined in original JS models)

This ensures Sequelize doesn't attempt to create duplicate columns, which was causing "column does not exist" errors in tests.

Testing

  • ✅ TypeScript compilation successful with no errors
  • ✅ All model associations work correctly
  • ✅ Test failures resolved (foreign key column issues fixed)

Thank you for your contribution!


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 2, 2026 15:12
Co-authored-by: alexanmtz <88840+alexanmtz@users.noreply.github.com>
Co-authored-by: alexanmtz <88840+alexanmtz@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert models to TypeScript and run tests Convert models directory to TypeScript Feb 2, 2026
Copilot AI requested a review from alexanmtz February 2, 2026 15:18

@alexanmtz alexanmtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many tests are failing

  1. Task Solution
    Create task Solution
    should create a task solution with an existing assign:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/api/task-solution/taskSolution.test.ts:132:9)

  2. Task Solution
    Create task Solution
    should create a task solution with stripe response with insufficient capatibilities:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/api/task-solution/taskSolution.test.ts:219:9)

  3. Task Solution
    Create task Solution
    should update a task solution:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/api/task-solution/taskSolution.test.ts:288:9)

  4. DELETE /tasks/delete/:id
    should delete a task by id:
    Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/circleci/repo/test/api/task/task-delete.test.ts)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

  5. DELETE /tasks/delete/:id
    should only delete own task:
    Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/circleci/repo/test/api/task/task-delete.test.ts)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

  6. DELETE /tasks/delete/:id
    should not delete task of another user:
    Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/circleci/repo/test/api/task/task-delete.test.ts)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

  7. DELETE /tasks/delete/:id
    should return error when deleting task with orders:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/api/task/task-delete.test.ts:74:19)

  8. Current User Info
    should fetch initial user info by userId:
    Error: expected 200 "OK", got 500 "Internal Server Error"
    at Context. (test/api/user/userInfo.test.ts:22:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Current User Info
    should fetch user info after creating tasks and payments:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.bulkInsert (node_modules/sequelize/src/dialects/abstract/query-interface.js:881:21)
    at recursiveBulkCreate (node_modules/sequelize/src/model.js:2851:25)
    at Function.bulkCreate (node_modules/sequelize/src/model.js:2977:12)
    at Context. (test/api/user/userInfo.test.ts:42:5)

  2. Crons
    Order
    should update order status when payment expired on Paypal:
    TypeError: Cannot read properties of undefined (reading 'source_id')
    at Context. (test/cron.test.ts:47:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  3. Crons
    Order
    should update order status when payment authorization expired after one month on Paypal:
    TypeError: Cannot read properties of undefined (reading 'source_id')
    at Context. (test/cron.test.ts:74:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  4. Orders
    should transfer a Stripe order:
    column "taskId" of relation "Orders" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Context. (test/order.test.ts:918:19)

  5. Orders
    create Order
    should create a new order:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:82:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should not call notifyNewBounty when order is created for a task with not_listed set to true:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at orderBuilds (src/modules/orders/orderBuilds.ts:33:17)
    at Context. (test/order.test.ts:106:9)

  2. Orders
    create Order
    should not call notifyNewBounty when order is created for a task with private set to true:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at orderBuilds (src/modules/orders/orderBuilds.ts:33:17)
    at Context. (test/order.test.ts:136:9)

  3. Orders
    create Order
    should not call notifyNewBounty when order is created (notification only on payment completion):
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at orderBuilds (src/modules/orders/orderBuilds.ts:33:17)
    at Context. (test/order.test.ts:167:9)

  4. Orders
    create Order
    should call notifyNewBounty when wallet payment completes for a public task:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at Wallet.spendBalance (src/models/wallet.ts:123:20)
    at Wallet.totalBalance (src/models/wallet.ts:141:31)
    at updateWalletBalance (src/models/wallet.ts:84:28)
    at Function.afterFind (src/models/wallet.ts:75:15)
    at Function.runHooks (node_modules/sequelize/src/hooks.js:131:7)
    at Function.findAll (node_modules/sequelize/src/model.js:1826:7)
    at Function.findOne (node_modules/sequelize/src/model.js:1998:12)
    at Wallet.reload (node_modules/sequelize/src/model.js:4264:22)
    at Context. (test/order.test.ts:207:9)

  5. Orders
    create Order
    should not call notifyNewBounty when wallet payment completes for a private task:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at Wallet.spendBalance (src/models/wallet.ts:123:20)
    at Wallet.totalBalance (src/models/wallet.ts:141:31)
    at updateWalletBalance (src/models/wallet.ts:84:28)
    at Function.afterFind (src/models/wallet.ts:75:15)
    at Function.runHooks (node_modules/sequelize/src/hooks.js:131:7)
    at Function.findAll (node_modules/sequelize/src/model.js:1826:7)
    at Function.findOne (node_modules/sequelize/src/model.js:1998:12)
    at Wallet.reload (node_modules/sequelize/src/model.js:4264:22)
    at Context. (test/order.test.ts:262:9)

  6. Orders
    create Order
    should create a order type invoice-item and create customer if theres no customer associated:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:411:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should create a order type invoice-item with a existing customer:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:459:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should create a order type wallet funds:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:554:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should create a order type wallet funds with enough balance:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:597:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should create a new paypal order:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:651:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should cancel a paypal order:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:705:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should fetch a paypal order with details:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:770:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    should authorize a paypal order:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Context. (test/order.test.ts:794:21)

  2. Orders
    create Order
    should update a paypal order:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Context. (test/order.test.ts:836:21)

  3. Orders
    create Order
    should get order details simple:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Context. (test/order.test.ts:855:21)

  4. Orders
    create Order
    should get order invoice:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Context. (test/order.test.ts:879:21)

  5. Orders
    create Order
    Order with Plan
    should create a new order with a plan:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:303:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    create Order
    Order with Plan
    should create a new order with no exact amount with a plan:
    Error: expected 200 "OK", got 401 "Unauthorized"
    at Context. (test/order.test.ts:332:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Orders
    PayPal payment notifications
    should call notifyNewBounty when PayPal payment completes for a public task:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/order.test.ts:983:23)

  2. Orders
    PayPal payment notifications
    should not call notifyNewBounty when PayPal payment completes for a private task:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at OrderFactory (test/factories/orderFactory.ts:15:17)
    at Context. (test/order.test.ts:1060:23)

  3. Queries - Issue - Bounty - findUnclaimedBounties
    should return unclaimed bounties:
    column Orders.taskId does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at findUnclaimedBounties (src/queries/issue/bounty/findUnclaimedBounties.ts:8:17)
    at Context. (test/queries/issue/bounty/findUnclaimedBounties.test.ts:49:31)

  4. Scripts
    Scripts
    Check for total Gitpay Balance:
    AssertionError: expected 0 to deeply equal { Object (payments_fee, payouts) }
    at Assertion.assertEqual (node_modules/chai/lib/chai/core/assertions.js:485:19)
    at ctx. [as equal] (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
    at Context. (test/scripts.test.ts:59:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  5. tasks
    Task crud
    should not raise an error on fetch if the issue build responds with limit exceeded:
    AssertionError: expected undefined to equal 1
    at Context. (test/task.test.ts:212:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  6. tasks
    Task crud
    should update status to closed when is paid:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/task.test.ts:707:21)

  7. tasks
    Task crud
    task fetch
    should fetch task:
    TypeError: Cannot read properties of undefined (reading 'id')
    at Context. (test/task.test.ts:376:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  8. tasks
    Task crud
    task fetch
    should fetch task and not sync status in_progress on Gitpay and open on Github:
    TypeError: Cannot read properties of undefined (reading 'id')
    at Context. (test/task.test.ts:417:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  9. tasks
    Task crud
    task fetch
    should fetch task and sync status in_progress on Gitpay and closed on Github:
    TypeError: Cannot read properties of undefined (reading 'id')
    at Context. (test/task.test.ts:452:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  10. Transfer
    Initial transfer with one credit card and account activated
    should not create transfer with no orders:
    AssertionError: expected undefined to equal 'No orders found'
    at Context. (test/transfer.test.ts:52:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  11. Transfer
    Initial transfer with one credit card and account activated
    should not create a transfer with no user assigned:
    AssertionError: expected undefined to equal 'No user assigned'
    at Context. (test/transfer.test.ts:64:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  12. Transfer
    Initial transfer with one credit card and account activated
    should not create transfer with no paid order:
    AssertionError: expected undefined to equal 'All orders must be paid'
    at Context. (test/transfer.test.ts:78:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  13. Transfer
    Initial transfer with one credit card and account activated
    should create transfer with a single order paid with stripe:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:98:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  14. Transfer
    Initial transfer with one credit card and account activated
    should create transfer with two orders paid with stripe:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:128:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  15. Transfer
    Initial transfer with one credit card and account activated
    should create transfer with three multiple orders paid with stripe:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:164:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  16. Transfer
    Initial transfer with one credit card and account activated
    should create transfer with three multiple orders paid with stripe and paypal but paypal not paid:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:199:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  17. Transfer
    Initial transfer with one credit card and account activated
    should create transfer with three mulltiple orders paid with stripe and paypal with two orders paid in multiple methods:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:265:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  18. Transfer
    Initial transfer with one credit card and account activated
    should update transfer pending to created for a pending transfer for an activated account:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:296:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  19. Transfer
    Initial transfer with one credit card and account activated
    should update transfer pending to created for a pending transfer for an activated account with multiple payments:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:374:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  20. Transfer
    Initial transfer with one credit card and account activated
    should update transfer pending to created and update value for a pending transfer for an activated account for multiple payments:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:440:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  21. Transfer
    Initial transfer with one credit card and account activated
    should fetch transfer with a paypal associated payout:
    AssertionError: expected undefined to equal 'in_transit'
    at Context. (test/transfer.test.ts:560:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  22. Transfer
    Initial transfer with one credit card and account activated
    should not create transfers with same id:
    AssertionError: expected undefined to equal 'This transfer already exists'
    at Context. (test/transfer.test.ts:590:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  23. Transfer
    Initial transfer with one credit card and account activated
    should not create transfers with same taskId:
    AssertionError: expected undefined to equal 'Only one transfer for an issue'
    at Context. (test/transfer.test.ts:609:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  24. Wallet
    should list wallets:
    Error: expected 200 "OK", got 400 "Bad Request"
    at Context. (test/wallet.test.ts:66:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. Wallet
    should fetch wallet:
    Error: expected 200 "OK", got 400 "Bad Request"
    at Context. (test/wallet.test.ts:84:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. WalletOrder
    creating wallet order
    should create an initial wallet Order:
    Error: expected 201 "Created", got 400 "Bad Request"
    at Context. (test/walletOrder.test.ts:51:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. WalletOrder
    updating wallet order
    should update an initial wallet Order with balance updated when order is paid:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at Wallet.spendBalance (src/models/wallet.ts:123:20)
    at Wallet.totalBalance (src/models/wallet.ts:141:31)
    at updateWalletBalance (src/models/wallet.ts:84:28)
    at Function.afterFind (src/models/wallet.ts:75:15)
    at Function.runHooks (node_modules/sequelize/src/hooks.js:131:7)
    at Function.findAll (node_modules/sequelize/src/model.js:1826:7)
    at Function.findOne (node_modules/sequelize/src/model.js:1998:12)
    at Context. (test/walletOrder.test.ts:118:29)

  2. WalletOrder
    updating wallet order
    should create many wallet Orders with balance updated when order is succeeded:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at Wallet.spendBalance (src/models/wallet.ts:123:20)
    at Wallet.totalBalance (src/models/wallet.ts:141:31)
    at updateWalletBalance (src/models/wallet.ts:84:28)
    at Function.afterFind (src/models/wallet.ts:75:15)
    at Function.runHooks (node_modules/sequelize/src/hooks.js:131:7)
    at Function.findAll (node_modules/sequelize/src/model.js:1826:7)
    at Function.findOne (node_modules/sequelize/src/model.js:1998:12)
    at Context. (test/walletOrder.test.ts:176:29)

  3. WalletOrder
    updating wallet order
    should update wallet order:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.select (node_modules/sequelize/src/dialects/abstract/query-interface.js:1001:12)
    at Function.findAll (node_modules/sequelize/src/model.js:1824:21)
    at Wallet.spendBalance (src/models/wallet.ts:123:20)
    at Wallet.totalBalance (src/models/wallet.ts:141:31)
    at updateWalletBalance (src/models/wallet.ts:84:28)
    at Function.afterFind (src/models/wallet.ts:75:15)
    at Function.runHooks (node_modules/sequelize/src/hooks.js:131:7)
    at Function.findAll (node_modules/sequelize/src/model.js:1826:7)
    at Function.findOne (node_modules/sequelize/src/model.js:1998:12)
    at Context. (test/walletOrder.test.ts:209:29)

  4. WalletOrder
    list wallet orders
    should list wallet orders:
    Error: expected 200 "OK", got 400 "Bad Request"
    at Context. (test/walletOrder.test.ts:237:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. webhooks for platform
    webhooks for charge
    should update balance after a refund is triggered:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/webhook.platform.test.ts:89:21)

  2. webhooks for platform
    webhooks for charge
    should update the order when a webhook charge.succeeded is triggered:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/webhook.platform.test.ts:121:21)

  3. webhooks for platform
    webhooks for charge
    should create the order when a webhook charge.succeeded is triggered and the order does not exist:
    Error: expected "Content-Type" matching /json/, got "text/html; charset=utf-8"
    at Context. (test/webhook.platform.test.ts:155:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertHeader (node_modules/supertest/lib/test.js:247:16)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. webhooks for platform
    webhooks for charge
    should update the order when a webhook charge.failed is triggered:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/webhook.platform.test.ts:174:21)

  2. webhooks for platform
    webhooks for invoice
    should notify the user when the invoice is created:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/webhook.platform.test.ts:342:21)

  3. webhooks for platform
    webhooks for invoice
    should notify the user when the invoice is updated:
    column "taskId" does not exist
    Error
    at Query.run (node_modules/sequelize/src/dialects/postgres/query.js:76:25)
    at (node_modules/sequelize/src/sequelize.js:650:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostgresQueryInterface.insert (node_modules/sequelize/src/dialects/abstract/query-interface.js:795:21)
    at Order.save (node_modules/sequelize/src/model.js:4154:35)
    at Function.create (node_modules/sequelize/src/model.js:2305:12)
    at HasMany.create (node_modules/sequelize/src/associations/has-many.js:483:12)
    at Context. (test/webhook.platform.test.ts:379:21)

  4. webhooks for platform
    webhooks for Wallet order
    should create a new wallet order when a webhook invoice.create is triggered:
    Error: expected 200 "OK", got 400 "Bad Request"
    at Context. (test/webhook.platform.test.ts:499:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
  1. webhooks for platform
    webhooks for Wallet order
    should create a new wallet order when a webhook invoice.updated is triggered:
    Error: expected 200 "OK", got 400 "Bad Request"
    at Context. (test/webhook.platform.test.ts:525:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  at Test._assertStatus (node_modules/supertest/lib/test.js:267:14)
  at /home/circleci/repo/node_modules/supertest/lib/test.js:323:13
  at Test._assertFunction (node_modules/supertest/lib/test.js:300:13)
  at Test.assert (node_modules/supertest/lib/test.js:179:23)
  at Server.localAssert (node_modules/supertest/lib/test.js:135:14)
  at Object.onceWrapper (node:events:631:28)
  at Server.emit (node:events:517:28)
  at emitCloseNT (node:net:2221:8)
  at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

Exited with code exit status 70

Please run the tests and make sure they pass before finishing

… added foreign keys

Foreign key columns should only be defined in model schema when they were explicitly defined in the original JS models. Many models had foreign keys only in associations, not in the schema definition.

Co-authored-by: alexanmtz <88840+alexanmtz@users.noreply.github.com>

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

Many tests are failing

...

Fixed in commit 06882c9. The issue was that I incorrectly added foreign key column definitions (like taskId, userId) to model schemas where they should only be defined through associations. Sequelize automatically creates these columns from the belongsTo associations. Removed foreign key columns from: assign, member, offer, taskSolution, order, paymentRequest, organization, task, and plan models.

Copilot AI requested a review from alexanmtz February 2, 2026 15:26
@alexanmtz
alexanmtz marked this pull request as ready for review February 2, 2026 15:33
@dosubot dosubot Bot added the bug label Feb 2, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Feb 2, 2026
@alexanmtz
alexanmtz merged commit 78a38f8 into master Feb 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants