From 794368883dd3e5aa629a6436a14530e986fcfbe1 Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Mon, 2 Oct 2023 06:49:02 -0400 Subject: [PATCH] Added model and started working on endpoint Working on endpoint to create contacts using a file --- Controllers/ContactQueueCreationController.cs | 2 ++ Models/Contact.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Controllers/ContactQueueCreationController.cs b/Controllers/ContactQueueCreationController.cs index a6af7ad..491b24e 100644 --- a/Controllers/ContactQueueCreationController.cs +++ b/Controllers/ContactQueueCreationController.cs @@ -26,6 +26,8 @@ public class ContactQueueCreationController : ControllerBase public IActionResult Upload([FromForm(Name = "file")] List contactFile, [FromForm(Name = "user_id")] string userID) { + // TODO: Save the file on the filesystem to be processed by a separate + // system return Ok(); } #endregion diff --git a/Models/Contact.cs b/Models/Contact.cs index 3f8cfdd..23a9470 100644 --- a/Models/Contact.cs +++ b/Models/Contact.cs @@ -1,5 +1,8 @@ using System; +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + namespace TextSender_API.Models; public class Contact @@ -13,3 +16,23 @@ public class Contact public int UserID { get; set; } #endregion } + + +public class ContactCreationQueue +{ + #region Properties + [BsonId] + [BsonRepresentation(BsonType.ObjectId)] + public string? Id { get; set; } + [BsonElement("filepath")] + public string? Filepath { get; set; } + [BsonElement("status")] + public string? Status { get; set; } + [BsonElement("user_id")] + public string? UserId { get; set; } + [BsonElement("date_created")] + public DateTime? DateCreated { get; set; } + [BsonElement("processed")] + public bool? Processed { get; set; } + #endregion +} \ No newline at end of file