summaryrefslogtreecommitdiffstats
path: root/src/server/Api/V1/Entries/CreateEntryRequest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Api/V1/Entries/CreateEntryRequest.cs')
-rw-r--r--src/server/Api/V1/Entries/CreateEntryRequest.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/server/Api/V1/Entries/CreateEntryRequest.cs b/src/server/Api/V1/Entries/CreateEntryRequest.cs
new file mode 100644
index 0000000..a9c5070
--- /dev/null
+++ b/src/server/Api/V1/Entries/CreateEntryRequest.cs
@@ -0,0 +1,27 @@
+namespace IOL.BookmarkThing.Server.Api.V1.Entries;
+
+public class CreateEntryRequest
+{
+ public Uri Url { get; set; }
+ public string Description { get; set; }
+ public string Tags { get; set; }
+
+ public List<ErrorResult> GetErrors() {
+ var errors = new List<ErrorResult>();
+ if (Url == default) {
+ errors.Add(new ErrorResult("Url is a required field"));
+ }
+
+ return errors;
+ }
+
+ public Entry AsDbEntity(Guid userId) {
+ return new Entry {
+ Id = Guid.NewGuid(),
+ UserId = userId,
+ Url = Url,
+ Description = Description,
+ Tags = Tags
+ };
+ }
+}