chore: Unify backend express project into ESM (#281)

This commit is contained in:
kimatata
2025-09-15 22:46:46 +09:00
committed by GitHub
parent 72fd3af24f
commit 761869736e
83 changed files with 2129 additions and 2328 deletions

View File

@@ -1,12 +1,17 @@
const fs = require('fs');
const path = require('path');
const express = require('express');
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import express from 'express';
const router = express.Router();
const { DataTypes } = require('sequelize');
const defineAttachment = require('../../models/attachments');
import { DataTypes } from 'sequelize';
import defineAttachment from '../../models/attachments.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
module.exports = function (sequelize) {
export default function (sequelize) {
const Attachment = defineAttachment(sequelize, DataTypes);
// TODO middleware to verify user permission to get attachment
router.get('/download/:attachmentId', async (req, res) => {
const attachmentId = req.params.attachmentId;
@@ -30,4 +35,4 @@ module.exports = function (sequelize) {
});
return router;
};
}