first initialization gallery
This commit is contained in:
@@ -9,6 +9,8 @@ class SocialNetworkController {
|
||||
this.getFolders = this.getFolders.bind(this);
|
||||
this.uploadImage = this.uploadImage.bind(this);
|
||||
this.getImage = this.getImage.bind(this);
|
||||
this.getImageVisibilityTypes = this.getImageVisibilityTypes.bind(this);
|
||||
this.getFolderImageList = this.getFolderImageList.bind(this);
|
||||
}
|
||||
|
||||
async userSearch(req, res) {
|
||||
@@ -39,8 +41,9 @@ class SocialNetworkController {
|
||||
|
||||
async createFolder(req, res) {
|
||||
try {
|
||||
const userId = req.headers.userid;
|
||||
const folderData = req.body;
|
||||
const folder = await this.socialNetworkService.createFolder(folderData);
|
||||
const folder = await this.socialNetworkService.createFolder(userId, folderData);
|
||||
res.status(201).json(folder);
|
||||
} catch (error) {
|
||||
console.error('Error in createFolder:', error);
|
||||
@@ -59,10 +62,23 @@ class SocialNetworkController {
|
||||
}
|
||||
}
|
||||
|
||||
async getFolderImageList(req, res) {
|
||||
try {
|
||||
const userId = req.headers.userid;
|
||||
const { folderId } = req.params;
|
||||
const images = await this.socialNetworkService.getFolderImageList(userId, folderId);
|
||||
res.status(200).json(images);
|
||||
} catch (error) {
|
||||
console.error('Error in getFolderImageList:', error);
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async uploadImage(req, res) {
|
||||
try {
|
||||
const userId = req.headers.userid;
|
||||
const imageData = req.body;
|
||||
const image = await this.socialNetworkService.uploadImage(imageData);
|
||||
const image = await this.socialNetworkService.uploadImage(userId, imageData);
|
||||
res.status(201).json(image);
|
||||
} catch (error) {
|
||||
console.error('Error in uploadImage:', error);
|
||||
@@ -80,6 +96,16 @@ class SocialNetworkController {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async getImageVisibilityTypes(req, res) {
|
||||
try {
|
||||
const types = await this.socialNetworkService.getPossibleImageVisibilities();
|
||||
res.status(200).json(types);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default SocialNetworkController;
|
||||
|
||||
Reference in New Issue
Block a user