Erster Aufbau Forum

This commit is contained in:
Torsten Schulz
2024-10-15 16:28:42 +02:00
parent c31be3f879
commit 663564aa96
163 changed files with 9449 additions and 116 deletions

View File

@@ -254,9 +254,9 @@ class SocialNetworkController {
async updateDiaryEntry(req, res) {
try {
const { diaryId } = req.params;
const { diaryEntryId } = req.params;
const { userId, text } = req.body;
const updatedEntry = await this.socialNetworkService.updateDiaryEntry(diaryId, userId, text);
const updatedEntry = await this.socialNetworkService.updateDiaryEntry(diaryEntryId, userId, text);
res.status(200).json(updatedEntry);
} catch (error) {
console.error('Error in updateDiaryEntry:', error);
@@ -266,9 +266,9 @@ class SocialNetworkController {
async deleteDiaryEntry(req, res) {
try {
const { diaryId } = req.params;
const { entryId } = req.params;
const { userId } = req.body;
const result = await this.socialNetworkService.deleteDiaryEntry(diaryId, userId);
const result = await this.socialNetworkService.deleteDiaryEntry(entryId, userId);
res.status(200).json({ message: 'Entry deleted successfully', result });
} catch (error) {
console.error('Error in deleteDiaryEntry:', error);
@@ -278,8 +278,9 @@ class SocialNetworkController {
async getDiaryEntries(req, res) {
try {
const { userId } = req.params;
const entries = await this.socialNetworkService.getDiaryEntries(userId);
const { userid: userId} = req.headers;
const { page } = req.params;
const entries = await this.socialNetworkService.getDiaryEntries(userId, page);
res.status(200).json(entries);
} catch (error) {
console.error('Error in getDiaryEntries:', error);