Changing database schema a bit

This commit is contained in:
Gregory Ballantine
2024-06-08 09:47:48 -04:00
parent 584a6087ba
commit 7375c1ce39
6 changed files with 13 additions and 9 deletions

View File

@ -26,4 +26,8 @@ Benchmark.hasMany(Result);
Result.belongsTo(Test);
Test.hasMany(Result);
// Result/Hardware many-to-one
Result.belongsTo(Hardware);
Hardware.hasMany(Result);
module.exports = sequelize;

View File

@ -2,7 +2,7 @@ const { Sequelize } = require("sequelize");
module.exports = (sequelize) => {
const Test = sequelize.define('Test', {
dateTag: {
title: {
type: Sequelize.STRING,
null: false,
},

View File

@ -41,7 +41,7 @@ exports.getAdd = async function(req, res) {
// POST /test/add - add the test to the database
exports.postAdd = async function(req, res) {
var test = await Test.create({
dateTag: req.body.test_date_tag,
title: req.body.test_title,
description: req.body.test_description,
});