Introduce prettier

This commit is contained in:
Takeshi Kimata
2024-05-19 21:04:45 +09:00
parent cbb5993276
commit 75eeebefda
89 changed files with 872 additions and 944 deletions

View File

@@ -1,24 +1,24 @@
const express = require("express");
const express = require('express');
const router = express.Router();
const defineCase = require("../../models/cases");
const defineStep = require("../../models/steps");
const defineAttachment = require("../../models/attachments");
const { DataTypes } = require("sequelize");
const defineCase = require('../../models/cases');
const defineStep = require('../../models/steps');
const defineAttachment = require('../../models/attachments');
const { DataTypes } = require('sequelize');
module.exports = function (sequelize) {
const Case = defineCase(sequelize, DataTypes);
const Step = defineStep(sequelize, DataTypes);
const Attachment = defineAttachment(sequelize, DataTypes);
Case.belongsToMany(Step, { through: "caseSteps" });
Step.belongsToMany(Case, { through: "caseSteps" });
Case.belongsToMany(Attachment, { through: "caseAttachments" });
Attachment.belongsToMany(Case, { through: "caseAttachments" });
Case.belongsToMany(Step, { through: 'caseSteps' });
Step.belongsToMany(Case, { through: 'caseSteps' });
Case.belongsToMany(Attachment, { through: 'caseAttachments' });
Attachment.belongsToMany(Case, { through: 'caseAttachments' });
router.get("/:caseId", async (req, res) => {
router.get('/:caseId', async (req, res) => {
const caseId = req.params.caseId;
if (!caseId) {
return res.status(400).json({ error: "caseId is required" });
return res.status(400).json({ error: 'caseId is required' });
}
try {
@@ -26,7 +26,7 @@ module.exports = function (sequelize) {
include: [
{
model: Step,
through: { attributes: ["stepNo"] },
through: { attributes: ['stepNo'] },
},
{
model: Attachment,
@@ -36,7 +36,7 @@ module.exports = function (sequelize) {
return res.json(testcase);
} catch (error) {
console.error(error);
res.status(500).send("Internal Server Error");
res.status(500).send('Internal Server Error');
}
});