Move db context out of the main api project
This commit is contained in:
38
TwilioSMSReceiver.Data/Models/SMSModel.cs
Normal file
38
TwilioSMSReceiver.Data/Models/SMSModel.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TwilioSMSReceiver.Data.Models
|
||||
{
|
||||
public class SMSModel
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string ReceivedNumber { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SenderNumber { get; set; }
|
||||
public DateTime TimeReceived { get; set; }
|
||||
public string? MessageContents { get; set; }
|
||||
public ICollection<MMSModel> MMSContent { get; set; }
|
||||
public bool IsForwardedYet { get; set; }
|
||||
}
|
||||
|
||||
public class MMSModel
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int SMSModelId { get; set; }
|
||||
public SMSModel ParentSMSMessage { get; set; }
|
||||
public string OriginalMMSData { get; set; }
|
||||
}
|
||||
|
||||
public class MSTeamsWebHook
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string WebHookUri { get; set; }
|
||||
}
|
||||
}
|
||||
16
TwilioSMSReceiver.Data/SMSDbCtx.cs
Normal file
16
TwilioSMSReceiver.Data/SMSDbCtx.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TwilioSMSReceiver.Data.Models;
|
||||
|
||||
namespace TwilioSMSReceiver.Data
|
||||
{
|
||||
public class SMSDbCtx : DbContext
|
||||
{
|
||||
public SMSDbCtx(DbContextOptions options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<SMSModel> SMSMessages { get; set; }
|
||||
public DbSet<MMSModel> MMSMessages { get; set; }
|
||||
public DbSet<MSTeamsWebHook> MSTeamsWebHooks { get; set; }
|
||||
}
|
||||
}
|
||||
12
TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj
Normal file
12
TwilioSMSReceiver.Data/TwilioSMSReceiver.Data.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user