Move db context out of the main api project
This commit is contained in:
parent
5d206ded1b
commit
7cd388c85b
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -3,7 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.31912.275
|
VisualStudioVersion = 17.0.31912.275
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwilioSMSReceiver", "TwilioSMSReceiver\TwilioSMSReceiver.csproj", "{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TwilioSMSReceiver", "TwilioSMSReceiver\TwilioSMSReceiver.csproj", "{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{642DADA5-E7A1-4754-A035-E2498C6CCF38} = {642DADA5-E7A1-4754-A035-E2498C6CCF38}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwilioSMSReceiver.Data", "TwilioSMSReceiver.Data\TwilioSMSReceiver.Data.csproj", "{642DADA5-E7A1-4754-A035-E2498C6CCF38}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
@ -15,6 +20,10 @@ Global
|
||||||
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{223C45EA-FAAC-44B8-B7DF-5DAA257CB52E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{642DADA5-E7A1-4754-A035-E2498C6CCF38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{642DADA5-E7A1-4754-A035-E2498C6CCF38}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{642DADA5-E7A1-4754-A035-E2498C6CCF38}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{642DADA5-E7A1-4754-A035-E2498C6CCF38}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue