From 66ad4ba5365eb6a07843c59f5c65f78999015385 Mon Sep 17 00:00:00 2001 From: "branislav.radivojevic" Date: Mon, 21 Nov 2022 15:04:34 +0100 Subject: implementacija tagova na postu --- Backend/Api/Api/Models/Post.cs | 5 +++-- Backend/Api/Api/Services/PostService.cs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Backend/Api') diff --git a/Backend/Api/Api/Models/Post.cs b/Backend/Api/Api/Models/Post.cs index 8099d6c..baadc24 100644 --- a/Backend/Api/Api/Models/Post.cs +++ b/Backend/Api/Api/Models/Post.cs @@ -18,6 +18,7 @@ namespace Api.Models public List ratings { get; set; } public List comments { get; set; } public List images { get; set; } + public List? tags { get; set; } } public class PostReceive { @@ -25,8 +26,7 @@ namespace Api.Models public string locationId { get; set; } public string description { get; set; } public List images { get; set; } - - + public string? tags { get; set; } } public class PostSend { @@ -39,6 +39,7 @@ namespace Api.Models public double ratings { get; set; } public List comments { get; set; } public List images { get; set; } + public List? tags { get; set; } } public class Rating { diff --git a/Backend/Api/Api/Services/PostService.cs b/Backend/Api/Api/Services/PostService.cs index cc4d064..bdf150b 100644 --- a/Backend/Api/Api/Services/PostService.cs +++ b/Backend/Api/Api/Services/PostService.cs @@ -39,6 +39,8 @@ namespace Api.Services p.comments = new List(); p.images = new List(); p.createdAt = DateTime.Now.ToUniversalTime(); + var tags = post.tags.Split("|").ToList(); + p.tags = tags; var folderPath = Path.Combine(Directory.GetCurrentDirectory(), "Files", p.ownerId); if (!Directory.Exists(folderPath)) { @@ -82,6 +84,7 @@ namespace Api.Services p.images = post.images; p.views = post.views.Count(); p.createdAt = post.createdAt; + p.tags = post.tags; if (post.ratings.Count() > 0) { List ratings = new List(); -- cgit v1.2.3