"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSheetWithFile = void 0;
const mongoose_1 = __importDefault(require("mongoose"));
const UploadedSheet_model_1 = __importDefault(require("../models/UploadedSheet.model"));
const getSheetWithFile = async (sheetId) => {
    return UploadedSheet_model_1.default.aggregate([
        {
            $match: {
                '_id': new mongoose_1.default.Types.ObjectId(sheetId)
            }
        }, {
            $lookup: {
                from: 'uploadedfiles',
                localField: 'fileId',
                foreignField: '_id',
                as: 'file'
            }
        }, {
            $unwind: {
                path: '$file'
            }
        }
    ]);
};
exports.getSheetWithFile = getSheetWithFile;
