diff --git a/sample_data/posts.json b/sample_data/posts.json index d2cec657a4..71db07f012 100644 --- a/sample_data/posts.json +++ b/sample_data/posts.json @@ -287,5 +287,209 @@ "createdAt": "2023-04-13T05:17:14.396Z", "updatedAt": "2023-04-13T05:17:14.396Z", "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087513", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Capturing the tranquility of snowflakes dancing in the crisp winter air.", + "title": "Snowflake Serenity", + "creatorId": "6589389d2caa9d8d69087487", + "organization": "6537904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-13T05:17:14.396Z", + "updatedAt": "2023-04-13T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087502", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Exploring the magic of winter nights with shimmering stars lighting up a frosty wonderland.", + "title": "Starry Winter Nights", + "creatorId": "6589389d2caa9d8d69087487", + "organization": "6537904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-02T05:17:14.396Z", + "updatedAt": "2023-04-02T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087503", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "The charm of early spring peeking through the snow, a hint of rebirth in a cold embrace.", + "title": "Spring's Whisper in Winter", + "creatorId": "6589389d2caa9d8d69087487", + "organization": "6537904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-03T05:17:14.396Z", + "updatedAt": "2023-04-03T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087504", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "A snowy path leads to warm stories by the fire—wintertime tales of joy and togetherness.", + "title": "Snowy Path to Warmth", + "creatorId": "6589387e2caa9d8d69087485", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-04T05:17:14.396Z", + "updatedAt": "2023-04-04T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087505", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Frosty mornings awaken the spirit of adventure, trekking through the snow-clad wilderness.", + "title": "Frosty Morning Treks", + "creatorId": "6589387e2caa9d8d69087485", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-05T05:17:14.396Z", + "updatedAt": "2023-04-05T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087506", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "The joy of building snowmen with loved ones, memories frozen in time.", + "title": "Snowman Chronicles", + "creatorId": "6589387e2caa9d8d69087485", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-06T05:17:14.396Z", + "updatedAt": "2023-04-06T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087507", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Skiing down majestic slopes, a thrilling embrace of nature’s winter canvas.", + "title": "Skiing Adventures", + "creatorId": "658930fd2caa9d8d6908745c", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-07T05:17:14.396Z", + "updatedAt": "2023-04-07T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087508", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Winter brings its culinary wonders, a feast of comfort and joy.", + "title": "Winter Feast Delights", + "creatorId": "658930fd2caa9d8d6908745c", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-08T05:17:14.396Z", + "updatedAt": "2023-04-08T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087509", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Exploring frozen lakes and finding reflections of serenity in icy waters.", + "title": "Reflections on Ice", + "creatorId": "658930fd2caa9d8d6908745c", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-09T05:17:14.396Z", + "updatedAt": "2023-04-09T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087510", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "The quiet beauty of snow-covered forests, where nature whispers its secrets.", + "title": "Snowy Forest Tales", + "creatorId": "64378abd85008f171cf2990d", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-10T05:17:14.396Z", + "updatedAt": "2023-04-10T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087511", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "Witnessing the ethereal glow of the northern lights in the heart of winter.", + "title": "Aurora Borealis Bliss", + "creatorId": "64378abd85008f171cf2990d", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-11T05:17:14.396Z", + "updatedAt": "2023-04-11T05:17:14.396Z", + "__v": 0 + }, + { + "_id": "6589bdd92caa9d8d69087512", + "status": "ACTIVE", + "likedBy": [], + "comments": [], + "likeCount": 0, + "commentCount": 0, + "pinned": true, + "text": "A journey through winter markets, where warmth meets festivity.", + "title": "Winter Market Magic", + "creatorId": "64378abd85008f171cf2990d", + "organization": "6437904485008f171cf29924", + "imageUrl": null, + "createdAt": "2023-04-12T05:17:14.396Z", + "updatedAt": "2023-04-12T05:17:14.396Z", + "__v": 0 } ] diff --git a/src/resolvers/Mutation/togglePostPin.ts b/src/resolvers/Mutation/togglePostPin.ts index c69434b0a7..3f5dd4688f 100644 --- a/src/resolvers/Mutation/togglePostPin.ts +++ b/src/resolvers/Mutation/togglePostPin.ts @@ -1,7 +1,6 @@ import mongoose from "mongoose"; import { LENGTH_VALIDATION_ERROR, - PLEASE_PROVIDE_TITLE, POST_NOT_FOUND_ERROR, USER_NOT_AUTHORIZED_ERROR, USER_NOT_AUTHORIZED_TO_PIN, @@ -188,12 +187,6 @@ export const togglePostPin: MutationResolvers["togglePostPin"] = async ( return updatedPost as InterfacePost; } else { // Pin the post if it is not currently pinned - if (!args.title) { - throw new errors.InputValidationError( - requestContext.translate(PLEASE_PROVIDE_TITLE.MESSAGE), - PLEASE_PROVIDE_TITLE.CODE, - ); - } // Validate the title length if provided if (args?.title) {