From a174e2281c0d10eba1f2843300b83576575227d6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 9 Oct 2024 23:07:28 +0530 Subject: [PATCH] feat: robot & run association --- server/src/models/associations.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 server/src/models/associations.ts diff --git a/server/src/models/associations.ts b/server/src/models/associations.ts new file mode 100644 index 00000000..50c22834 --- /dev/null +++ b/server/src/models/associations.ts @@ -0,0 +1,7 @@ +import Robot from './Robot'; +import Run from './Run'; + +export default function setupAssociations() { + Run.belongsTo(Robot, { foreignKey: 'robotId' }); + Robot.hasMany(Run, { foreignKey: 'robotId' }); +}