Feature: Device Batch Attachments

allows for attachments to be uploaded and associated with Device Batches
This commit is contained in:
Gary Sharp
2020-11-29 16:41:20 +11:00
parent e531ffe2b7
commit 28e5901929
26 changed files with 2153 additions and 320 deletions
@@ -4,6 +4,7 @@
{
Device,
Job,
User
User,
DeviceBatch,
}
}
@@ -50,6 +50,7 @@ namespace Disco.Models.Repository
[ForeignKey("DefaultDeviceModelId")]
public virtual DeviceModel DefaultDeviceModel { get; set; }
public virtual IList<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
public virtual IList<Device> Devices { get; set; }
public override string ToString()
@@ -0,0 +1,38 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class DeviceBatchAttachment : IAttachment
{
[Key]
public int Id { get; set; }
public int DeviceBatchId { get; set; }
[Required]
public string TechUserId { get; set; }
[StringLength(500), Required]
public string Filename { get; set; }
[Required, StringLength(500)]
public string MimeType { get; set; }
public DateTime Timestamp { get; set; }
[Required, StringLength(500)]
public string Comments { get; set; }
[NotMapped]
public object Reference => DeviceBatchId;
[NotMapped]
public AttachmentTypes AttachmentType => AttachmentTypes.DeviceBatch;
[NotMapped]
public string DocumentTemplateId { get => throw new NotSupportedException(); set => throw new NotSupportedException(); }
[InverseProperty(nameof(Repository.DeviceBatch.DeviceBatchAttachments)), ForeignKey(nameof(DeviceBatchId))]
public virtual DeviceBatch DeviceBatch { get; set; }
[ForeignKey("TechUserId")]
public virtual User TechUser { get; set; }
}
}