Skip to content

Can't delete all event data for relay #109

@lukaskett

Description

@lukaskett

Describe the bug
Button Delete all event data throws an error when the event has checked checkbox Relay. Deleting competitors works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Create relay event and upload data
  2. Push the button Delete all event data in Danger zone
  3. Confirm the dialog

Expected behavior
All data should be deleted without error.

Screenshots

Image

Additional context
I guess that delete in team table is missing.

Log

OPTIONS /rest/v1/events/cmj1w087q0001sl5w20edb0vm/delete-data 204 0 - 0.107 ms
Failed to delete all event data: PrismaClientKnownRequestError:
Invalid `prisma.class.deleteMany()` invocation:


Foreign key constraint violated on the fields: (`classId`)
    at ei.handleRequestError (D:\Coding\orienteerfeed\ofeed\node_modules\.pnpm\@[email protected]_prism_0ade0c2032e7f19289902b884120cfab\node_modules\@prisma\client\runtime\library.js:121:7268)
    at ei.handleAndLogRequestError (D:\Coding\orienteerfeed\ofeed\node_modules\.pnpm\@[email protected]_prism_0ade0c2032e7f19289902b884120cfab\node_modules\@prisma\client\runtime\library.js:121:6593)
    at ei.request (D:\Coding\orienteerfeed\ofeed\node_modules\.pnpm\@[email protected]_prism_0ade0c2032e7f19289902b884120cfab\node_modules\@prisma\client\runtime\library.js:121:6300)
    at async a (D:\Coding\orienteerfeed\ofeed\node_modules\.pnpm\@[email protected]_prism_0ade0c2032e7f19289902b884120cfab\node_modules\@prisma\client\runtime\library.js:130:9551)
    at async deleteAllEventData (file:///D:/Coding/orienteerfeed/ofeed/apps/server/src/modules/event/eventService.js:594:5)
    at async file:///D:/Coding/orienteerfeed/ofeed/apps/server/src/modules/event/secureEventRoutes.js:2121:29 {
  code: 'P2003',
  meta: { modelName: 'Class', constraint: [ 'classId' ] },
  clientVersion: '6.19.0'
}
DatabaseError: Error deleting all event data
    at deleteAllEventData (file:///D:/Coding/orienteerfeed/ofeed/apps/server/src/modules/event/eventService.js:604:11)
    at async file:///D:/Coding/orienteerfeed/ofeed/apps/server/src/modules/event/secureEventRoutes.js:2121:29 {
  statusCode: 500
}
DELETE /rest/v1/events/cmj1w087q0001sl5w20edb0vm/delete-data 500 67 - 33.482 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingpriority: lowTasks that are nice to have or lower impact. These can be addressed as time allows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions