mirror of
https://github.com/ChanX21/Sigillum
synced 2026-04-21 15:47:55 +00:00
fix
This commit is contained in:
parent
413160dc96
commit
549b833269
2 changed files with 13 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ import { v4 } from 'uuid';
|
|||
import { Nonce, Session, User, WebSocketSession } from '../models/User.js';
|
||||
import { verifyPersonalMessageSignature } from '@mysten/sui/verify';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { notifyImageUploaded, notifyNFTMinted, notifySoftListed, notifyBlobUploaded } from '../services/websocketService.js';
|
||||
import { notifyImageUploaded, notifyNFTMinted, notifySoftListed, notifyBlobUploaded, notifyFailed } from '../services/websocketService.js';
|
||||
|
||||
// Custom interface for request with file
|
||||
interface FileRequest extends Request {
|
||||
|
|
@ -227,7 +227,7 @@ export const uploadImage = async (req: FileRequest, res: Response): Promise<void
|
|||
res.status(200).json({ sessionId: jwt.sign({ sessionId: sessionId }, JWT_SECRET, { expiresIn: JWT_EXPIRATION }) });
|
||||
const blobId = await addBlob(req.file.buffer, authenticationData.vector);
|
||||
if(!blobId) {
|
||||
res.status(500).json({ message: 'Failed to add blob' });
|
||||
notifyFailed(sessionId, 'Failed to add blob');
|
||||
return;
|
||||
}
|
||||
// Send notification - Blob uploaded
|
||||
|
|
|
|||
|
|
@ -130,4 +130,14 @@ export const notifySoftListed = (sessionId: string, listingData: any) => {
|
|||
io.to(`image:${sessionId}`).emit('image:softListed', {
|
||||
listingData,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const notifyFailed = (sessionId: string, message: string) => {
|
||||
if (!io) return;
|
||||
|
||||
// Send to specific user's room
|
||||
io.to(`image:${sessionId}`).emit('image:failed', {
|
||||
sessionId,
|
||||
message,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue