Compare commits
34 Commits
dev
...
6fbe2197-r
Author | SHA1 | Date | |
---|---|---|---|
|
0c13528940 | ||
|
6fbe21979f | ||
|
fc166e65c9 | ||
|
ae6b306290 | ||
|
d3a751a6ad | ||
|
2182b9a6b3 | ||
|
8624eeeb97 | ||
|
16d45d6632 | ||
|
c77e0452c4 | ||
|
6ad5bb1572 | ||
|
8e0a7df68b | ||
|
cb3c7f8f6a | ||
|
01ccd97528 | ||
|
26b360e0a9 | ||
|
360a58c026 | ||
|
26e79432e2 | ||
|
11c6fc0dc9 | ||
|
99633d8dda | ||
|
8e3f6674c6 | ||
|
885fdeb117 | ||
|
14956057cd | ||
|
fa3e3bbd99 | ||
|
340ba6fa6d | ||
|
46794057c4 | ||
|
71d4b524e7 | ||
|
c7a2dc5910 | ||
|
643bc0c76a | ||
|
d0023114a3 | ||
|
465bf4b081 | ||
|
e04bccfffd | ||
|
0544c7397d | ||
|
9c536a1c52 | ||
|
48be1a74c9 | ||
|
eb07c31ff6 |
BIN
.vs/Backend-API-Services/v17/.wsuo
Normal file
BIN
.vs/Backend-API-Services/v17/.wsuo
Normal file
Binary file not shown.
7
.vs/VSWorkspaceState.json
Normal file
7
.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"SelectedNode": "\\DamageAssesment.sln",
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
1
DamageAssesmentApi/.gitignore
vendored
1
DamageAssesmentApi/.gitignore
vendored
@ -396,3 +396,4 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
**/migrations/
|
@ -13,7 +13,12 @@
|
|||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Answers.Db
|
namespace DamageAssesment.Api.Answers.Db
|
||||||
{
|
{
|
||||||
|
[Table("Answers")]
|
||||||
public class Answer
|
public class Answer
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Answers.Db
|
namespace DamageAssesment.Api.Answers.Db
|
||||||
{
|
{
|
||||||
public class AnswerDbContext:DbContext
|
public class AnswerDbContext:DbContext
|
||||||
{
|
{
|
||||||
|
private IConfiguration _Configuration { get; set; }
|
||||||
public AnswerDbContext(DbContextOptions options):base(options)
|
public AnswerDbContext(DbContextOptions options,IConfiguration configuration):base(options)
|
||||||
{
|
{
|
||||||
|
_Configuration= configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("AnswerConnection"));
|
||||||
}
|
}
|
||||||
public DbSet<Db.Answer> Answers { get; set; }
|
public DbSet<Db.Answer> Answers { get; set; }
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
@ -23,7 +23,7 @@ builder.Services.AddScoped<IAnswersProvider, AnswersProvider>();
|
|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
||||||
builder.Services.AddDbContext<AnswerDbContext>(option =>
|
builder.Services.AddDbContext<AnswerDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Answers");
|
option.UseSqlServer("AnswerConnection");
|
||||||
});
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
@ -198,13 +198,12 @@ namespace DamageAssesment.Api.Answers.Providers
|
|||||||
{
|
{
|
||||||
if (!answerDbContext.Answers.Any())
|
if (!answerDbContext.Answers.Any())
|
||||||
{
|
{
|
||||||
answerDbContext.Answers.Add(new Db.Answer() { Id = 1, AnswerText = "Yes", Comment = "Comment test 4", QuestionId = 1, SurveyResponseId = 1 });
|
answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "Yes", Comment = "", QuestionId = 1, SurveyResponseId = 1 });
|
||||||
answerDbContext.Answers.Add(new Db.Answer() { Id = 2, AnswerText = "No", Comment = "Comment test 5", QuestionId = 2, SurveyResponseId = 1 });
|
answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "No", Comment = "myComment", QuestionId = 2, SurveyResponseId = 1 });
|
||||||
// Uncomment the lines below to add more initial data if needed
|
//answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 1 });
|
||||||
//answerDbContext.Answers.Add(new Db.Answer() { Id = 3, AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 1 });
|
//answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "Yes", Comment = "No Comment", QuestionId = 1, SurveyResponseId = 2 });
|
||||||
//answerDbContext.Answers.Add(new Db.Answer() { Id = 4, AnswerText = "Yes", Comment = "No Comment", QuestionId = 1, SurveyResponseId = 2 });
|
//answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "No", Comment = "No Comment", QuestionId = 2, SurveyResponseId = 2 });
|
||||||
//answerDbContext.Answers.Add(new Db.Answer() { Id = 5, AnswerText = "No", Comment = "No Comment", QuestionId = 2, SurveyResponseId = 2 });
|
//answerDbContext.Answers.Add(new Db.Answer() { AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 2 });
|
||||||
//answerDbContext.Answers.Add(new Db.Answer() { Id = 6, AnswerText = "No", Comment = "No Comment", QuestionId = 3, SurveyResponseId = 2 });
|
|
||||||
answerDbContext.SaveChanges();
|
answerDbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,5 +8,11 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"AnswerConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||||
|
// "AnswerConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;",
|
||||||
|
"AnswerConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
sample
|
|
@ -14,8 +14,19 @@
|
|||||||
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
|
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Attachments.Db
|
namespace DamageAssesment.Api.Attachments.Db
|
||||||
{
|
{
|
||||||
|
[Table("AnswerAttachments")]
|
||||||
public class Attachment
|
public class Attachment
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Attachments.Db
|
namespace DamageAssesment.Api.Attachments.Db
|
||||||
{
|
{
|
||||||
public class AttachmentsDbContext:DbContext
|
public class AttachmentsDbContext:DbContext
|
||||||
{
|
{
|
||||||
public AttachmentsDbContext(DbContextOptions options) : base(options)
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public AttachmentsDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
{
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("AttachmentConnection"));
|
||||||
}
|
}
|
||||||
public DbSet<Db.Attachment> Attachments { get; set; }
|
public DbSet<Db.Attachment> Attachments { get; set; }
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
@ -27,7 +27,7 @@ builder.Services.AddScoped<IAzureBlobService,AzureBlobService>();
|
|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
||||||
builder.Services.AddDbContext<AttachmentsDbContext>(option =>
|
builder.Services.AddDbContext<AttachmentsDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Attachments");
|
option.UseSqlServer("AttachmentConnection");
|
||||||
});
|
});
|
||||||
builder.Services.Configure<FormOptions>(o =>
|
builder.Services.Configure<FormOptions>(o =>
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ namespace DamageAssesment.Api.Attachments.Providers
|
|||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
this.uploadservice = uploadservice;
|
this.uploadservice = uploadservice;
|
||||||
SeedData();
|
//SeedData();
|
||||||
}
|
}
|
||||||
public async Task<(bool IsSuccess, IEnumerable<Models.Attachment> Attachments, string ErrorMessage)> GetAttachmentsAsync()
|
public async Task<(bool IsSuccess, IEnumerable<Models.Attachment> Attachments, string ErrorMessage)> GetAttachmentsAsync()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,5 +12,11 @@
|
|||||||
"Fileupload": {
|
"Fileupload": {
|
||||||
"folderpath": "DMS_Attachments/Active",
|
"folderpath": "DMS_Attachments/Active",
|
||||||
"Deletepath": "DMS_Attachments/Deleted"
|
"Deletepath": "DMS_Attachments/Deleted"
|
||||||
|
},
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"AttachmentConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||||
|
// "AttachmentConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;"
|
||||||
|
"AttachmentConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
sample
|
|
@ -1 +0,0 @@
|
|||||||
sample
|
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.DocuLinks.Db
|
namespace DamageAssesment.Api.DocuLinks.Db
|
||||||
{
|
{
|
||||||
|
[Table("Doculinks")]
|
||||||
public class Doculink
|
public class Doculink
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.DocuLinks.Db
|
namespace DamageAssesment.Api.DocuLinks.Db
|
||||||
{
|
{
|
||||||
|
[Table("DoculinkAttachments")]
|
||||||
public class DoculinkAttachments
|
public class DoculinkAttachments
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -7,8 +7,15 @@ namespace DamageAssesment.Api.DocuLinks.Db
|
|||||||
{
|
{
|
||||||
public class DoculinkDbContext : DbContext
|
public class DoculinkDbContext : DbContext
|
||||||
{
|
{
|
||||||
public DoculinkDbContext(DbContextOptions options) : base(options)
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public DoculinkDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
{
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("DoculinConnection"));
|
||||||
}
|
}
|
||||||
public DbSet<Db.Doculink> Documents { get; set; }
|
public DbSet<Db.Doculink> Documents { get; set; }
|
||||||
public DbSet<Db.LinkType> LinkTypes { get; set; }
|
public DbSet<Db.LinkType> LinkTypes { get; set; }
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.DocuLinks.Db
|
namespace DamageAssesment.Api.DocuLinks.Db
|
||||||
{
|
{
|
||||||
|
[Table("DoculinkTrans")]
|
||||||
public class DoculinkTranslation
|
public class DoculinkTranslation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.DocuLinks.Db
|
namespace DamageAssesment.Api.DocuLinks.Db
|
||||||
{
|
{
|
||||||
|
[Table("DoculinkTypes")]
|
||||||
public class LinkType
|
public class LinkType
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.DocuLinks.Db
|
namespace DamageAssesment.Api.DocuLinks.Db
|
||||||
{
|
{
|
||||||
|
[Table("DoculinkTypeTrans")]
|
||||||
public class LinksTranslation
|
public class LinksTranslation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -25,7 +25,7 @@ builder.Services.AddScoped<IAzureBlobService, AzureBlobService>();
|
|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
||||||
builder.Services.AddDbContext<DoculinkDbContext>(option =>
|
builder.Services.AddDbContext<DoculinkDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("DocumentConnection");
|
option.UseSqlServer("DoculinConnection");
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
fileModel = new FileModel() { url = "www.google" + i + ".com", IsAttachments = false, CustomOrder = 1 };
|
fileModel = new FileModel() { url = "www.google" + i + ".com", IsAttachments = false, CustomOrder = 1 };
|
||||||
ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = linkTypeId, CustomOrder = i, Files = new List<FileModel>() { fileModel } };
|
ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = i, CustomOrder = i, Files = new List<FileModel>() { fileModel } };
|
||||||
Models.Doculink document = uploadservice.UploadDocument(counter, documentInfo);
|
Models.Doculink document = uploadservice.UploadDocument(counter, documentInfo);
|
||||||
DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document));
|
DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document));
|
||||||
DocumentDbContext.SaveChanges();
|
DocumentDbContext.SaveChanges();
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"DoculinConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;",
|
||||||
|
//"DoculinConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;"
|
||||||
|
"DoculinConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
|
||||||
|
},
|
||||||
"Fileupload": {
|
"Fileupload": {
|
||||||
"folderpath": "DASA_Documents/Active",
|
"folderpath": "DASA_Documents/Active",
|
||||||
"Deletepath": "DASA_Documents/Deleted"
|
"Deletepath": "DASA_Documents/Deleted"
|
||||||
|
@ -12,8 +12,18 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Employees.Db
|
namespace DamageAssesment.Api.Employees.Db
|
||||||
{
|
{
|
||||||
|
[Table("Employees")]
|
||||||
public class Employee
|
public class Employee
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -4,18 +4,23 @@ namespace DamageAssesment.Api.Employees.Db
|
|||||||
{
|
{
|
||||||
public class EmployeeDbContext: DbContext
|
public class EmployeeDbContext: DbContext
|
||||||
{
|
{
|
||||||
public DbSet<Db.Employee> Employees { get; set; }
|
private IConfiguration _Configuration { get; set; }
|
||||||
public EmployeeDbContext(DbContextOptions options) : base(options)
|
public EmployeeDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
{
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("EmployeeConnection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity<Employee>()
|
modelBuilder.Entity<Employee>()
|
||||||
.Property(item => item.Id)
|
.Property(item => item.Id)
|
||||||
.ValueGeneratedOnAdd();
|
.ValueGeneratedOnAdd();
|
||||||
}
|
}
|
||||||
|
public DbSet<Db.Employee> Employees { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ builder.Services.AddScoped<IEmployeesProvider, EmployeesProvider>();
|
|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
||||||
builder.Services.AddDbContext<EmployeeDbContext>(option =>
|
builder.Services.AddDbContext<EmployeeDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Employees");
|
option.UseSqlServer("EmployeeConnection");
|
||||||
});
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,5 +13,11 @@
|
|||||||
"endpoint1": "xxx",
|
"endpoint1": "xxx",
|
||||||
"endpoint2": "xxx",
|
"endpoint2": "xxx",
|
||||||
"endpoint3": "xxx"
|
"endpoint3": "xxx"
|
||||||
|
},
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"EmployeeConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;",
|
||||||
|
//"EmployeeConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;"
|
||||||
|
"EmployeeConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Locations.Db
|
namespace DamageAssesment.Api.Locations.Db
|
||||||
{
|
{
|
||||||
|
[Table("Locations")]
|
||||||
public class Location
|
public class Location
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -4,6 +4,16 @@ namespace DamageAssesment.Api.Locations.Db
|
|||||||
{
|
{
|
||||||
public class LocationDbContext : DbContext
|
public class LocationDbContext : DbContext
|
||||||
{
|
{
|
||||||
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public LocationDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("LocationConnection"));
|
||||||
|
}
|
||||||
public DbSet<Db.Location> Locations { get; set; }
|
public DbSet<Db.Location> Locations { get; set; }
|
||||||
public DbSet<Db.Region> Regions { get; set; }
|
public DbSet<Db.Region> Regions { get; set; }
|
||||||
public LocationDbContext(DbContextOptions options) : base(options)
|
public LocationDbContext(DbContextOptions options) : base(options)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Locations.Db
|
namespace DamageAssesment.Api.Locations.Db
|
||||||
{
|
{
|
||||||
|
[Table("Regions")]
|
||||||
public class Region
|
public class Region
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -24,7 +24,7 @@ builder.Services.AddScoped<IRegionsProvider, RegionsProvider>();
|
|||||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30
|
||||||
builder.Services.AddDbContext<LocationDbContext>(option =>
|
builder.Services.AddDbContext<LocationDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Locations");
|
option.UseSqlServer("LocationConnection");
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,5 +8,11 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"LocationConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;",
|
||||||
|
// "LocationConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;"
|
||||||
|
"LocationConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Questions.Db
|
namespace DamageAssesment.Api.Questions.Db
|
||||||
{
|
{
|
||||||
|
[Table("QuestionCategoryTrans")]
|
||||||
public class CategoryTranslation
|
public class CategoryTranslation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Questions.Db
|
namespace DamageAssesment.Api.Questions.Db
|
||||||
{
|
{
|
||||||
|
[Table("Questions")]
|
||||||
public class Question
|
public class Question
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System.Buffers.Text;
|
using System.Buffers.Text;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Questions.Db
|
namespace DamageAssesment.Api.Questions.Db
|
||||||
{
|
{
|
||||||
|
[Table("QuestionCategories")]
|
||||||
public class QuestionCategory
|
public class QuestionCategory
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -6,6 +6,16 @@ namespace DamageAssesment.Api.Questions.Db
|
|||||||
{
|
{
|
||||||
public class QuestionDbContext : DbContext
|
public class QuestionDbContext : DbContext
|
||||||
{
|
{
|
||||||
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public QuestionDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("QuestionConnection"));
|
||||||
|
}
|
||||||
public DbSet<Db.Question> Questions { get; set; }
|
public DbSet<Db.Question> Questions { get; set; }
|
||||||
public DbSet<Db.QuestionType> QuestionTypes { get; set; }
|
public DbSet<Db.QuestionType> QuestionTypes { get; set; }
|
||||||
public DbSet<Db.QuestionsTranslation> QuestionsTranslations { get; set; }
|
public DbSet<Db.QuestionsTranslation> QuestionsTranslations { get; set; }
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DamageAssesment.Api.Questions.Db
|
namespace DamageAssesment.Api.Questions.Db
|
||||||
{
|
{
|
||||||
|
[Table("QuestionTypes")]
|
||||||
public class QuestionType
|
public class QuestionType
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Questions.Db
|
namespace DamageAssesment.Api.Questions.Db
|
||||||
{
|
{
|
||||||
|
[Table("QuestionTrans")]
|
||||||
public class QuestionsTranslation
|
public class QuestionsTranslation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
public int CategoryId { get; set; }
|
public int CategoryId { get; set; }
|
||||||
public string IconName { get; set; }
|
public string IconName { get; set; }
|
||||||
public string IconLibrary { get; set; }
|
public string IconLibrary { get; set; }
|
||||||
|
public object CategoryNames { get; set; }
|
||||||
public List<MultiLanguage> QuestionsText { get; set; }
|
public List<MultiLanguage> QuestionsText { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
});
|
});
|
||||||
builder.Services.AddDbContext<QuestionDbContext>(option =>
|
builder.Services.AddDbContext<QuestionDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Questions");
|
option.UseSqlServer("QuestionConnection");
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ namespace DamageAssesment.Api.Questions.Providers
|
|||||||
questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "TextBox" });
|
questionDbContext.QuestionTypes.Add(new Db.QuestionType() { TypeText = "TextBox" });
|
||||||
questionDbContext.SaveChanges();
|
questionDbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
if (!questionDbContext.QuestionsTranslations.Any())
|
||||||
if (!questionDbContext.QuestionCategories.Any())
|
|
||||||
{
|
{
|
||||||
questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Flooding", IconLibrary = "https://example.com/images/img1.png" });
|
questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Flooding", IconLibrary = "https://example.com/images/img1.png" });
|
||||||
questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Electrical", IconLibrary = "https://example.com/images/img2.png" });
|
questionDbContext.QuestionCategories.Add(new Db.QuestionCategory() { IconName = "Electrical", IconLibrary = "https://example.com/images/img2.png" });
|
||||||
@ -65,14 +64,51 @@ namespace DamageAssesment.Api.Questions.Providers
|
|||||||
if (!questionDbContext.Questions.Any())
|
if (!questionDbContext.Questions.Any())
|
||||||
{
|
{
|
||||||
var question1 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
|
var question1 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
|
||||||
var question2 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 1 };
|
var question2 = new Db.Question() { QuestionTypeId = 1, SurveyId = 1, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
|
||||||
var question3 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
|
var question3 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
|
||||||
var question4 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 1 };
|
var question4 = new Db.Question() { QuestionTypeId = 1, SurveyId = 2, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
|
||||||
|
var question5 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
|
||||||
|
var question6 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 2 };
|
||||||
|
var question7 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 3};
|
||||||
|
var question8 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 4 };
|
||||||
|
var question9 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = true, Key = true, CategoryId = 5 };
|
||||||
|
var question10 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = false, Key = true, CategoryId = 1 };
|
||||||
|
var question11 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 2 };
|
||||||
|
var question12 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 3 };
|
||||||
|
var question13 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 4 };
|
||||||
|
var question14 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 5 };
|
||||||
|
var question15 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 1 };
|
||||||
|
var question16 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 2 };
|
||||||
|
var question17 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = false, CategoryId = 3 };
|
||||||
|
var question18 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 4 };
|
||||||
|
var question19 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 5 };
|
||||||
|
var question20 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = false, CategoryId = 1 };
|
||||||
|
var question21 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 2 };
|
||||||
|
var question22 = new Db.Question() { QuestionTypeId = 1, SurveyId = 3, QuestionNumber = 2, IsRequired = false, Comment = true, Key = true, CategoryId = 3 };
|
||||||
|
|
||||||
questionDbContext.Questions.Add(question1);
|
questionDbContext.Questions.Add(question1);
|
||||||
questionDbContext.Questions.Add(question2);
|
questionDbContext.Questions.Add(question2);
|
||||||
questionDbContext.Questions.Add(question3);
|
questionDbContext.Questions.Add(question3);
|
||||||
questionDbContext.Questions.Add(question4);
|
questionDbContext.Questions.Add(question4);
|
||||||
|
questionDbContext.Questions.Add(question5);
|
||||||
|
questionDbContext.Questions.Add(question6);
|
||||||
|
questionDbContext.Questions.Add(question7);
|
||||||
|
questionDbContext.Questions.Add(question8);
|
||||||
|
questionDbContext.Questions.Add(question9);
|
||||||
|
questionDbContext.Questions.Add(question10);
|
||||||
|
questionDbContext.Questions.Add(question11);
|
||||||
|
questionDbContext.Questions.Add(question12);
|
||||||
|
questionDbContext.Questions.Add(question13);
|
||||||
|
questionDbContext.Questions.Add(question14);
|
||||||
|
questionDbContext.Questions.Add(question15);
|
||||||
|
questionDbContext.Questions.Add(question16);
|
||||||
|
questionDbContext.Questions.Add(question17);
|
||||||
|
questionDbContext.Questions.Add(question18);
|
||||||
|
questionDbContext.Questions.Add(question19);
|
||||||
|
questionDbContext.Questions.Add(question20);
|
||||||
|
questionDbContext.Questions.Add(question21);
|
||||||
|
questionDbContext.Questions.Add(question22);
|
||||||
|
|
||||||
questionDbContext.SaveChanges();
|
questionDbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +126,64 @@ namespace DamageAssesment.Api.Questions.Providers
|
|||||||
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Are the grounds flooded ?", Language = "en" });
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Are the grounds flooded ?", Language = "en" });
|
||||||
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
|
||||||
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 4, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
|
||||||
|
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "Can you open?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "Is debris blocking access?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "Are the grounds flooded?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "Is the access blocked by flooding?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "Are any utility wires down?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "Do you have damage to windows, doors, or walls?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "Do you have roof damage?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "Do you have major water intrusion?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "Are any portable classrooms damaged and unusable?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "Does your facility need to be secured/boarded?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "Are you without commercial power?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "Are you without water pressure?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "Are you without telephones?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "Are traffic signals damaged/missing?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "Are you without an operable fire alarm?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "Are you without an operable public address?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "Do you have major debris?", Language = "en" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "Are there any problems or issues not addressed above that would impede you from opening? If yes, please explain below?", Language = "en" });
|
||||||
|
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "Pouvez-vous ouvrir ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "Est-ce que des débris bloquent l'accès ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "Les terrains sont-ils inondés ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "L'accès est-il bloqué par des inondations ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "Des câbles d'utilité sont-ils tombés ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "Avez-vous des dommages aux fenêtres, portes ou murs ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "Avez-vous des dommages au toit ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "Avez-vous une intrusion d'eau majeure ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "Les salles de classe portables sont-elles endommagées et inutilisables ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "Votre établissement a-t-il besoin d'être sécurisé/protégé ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "Êtes-vous sans alimentation électrique commerciale ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "Êtes-vous sans pression d'eau ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "Êtes-vous sans téléphones ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "Les feux de circulation sont-ils endommagés/absents ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "N'avez-vous pas d'alarme incendie fonctionnelle ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "N'avez-vous pas de système de sonorisation opérationnel ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "Avez-vous une grande quantité de débris ?", Language = "fr" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "Y a-t-il des problèmes ou des problèmes non abordés ci-dessus qui vous empêcheraient d'ouvrir ? Si oui, veuillez expliquer ci-dessous.", Language = "fr" });
|
||||||
|
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 5, QuestionText = "¿Puedes abrir ?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 6, QuestionText = "¿Los escombros bloquean el acceso?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 7, QuestionText = "¿Están inundados los terrenos?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 8, QuestionText = "¿El acceso está bloqueado por inundaciones?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 9, QuestionText = "¿Hay cables de utilidad caídos?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 10, QuestionText = "¿Tienes daños en ventanas, puertas o paredes?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 11, QuestionText = "¿Tienes daños en el techo?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 12, QuestionText = "¿Tienes una gran intrusión de agua?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 13, QuestionText = "¿Hay aulas portátiles dañadas e inutilizables?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 14, QuestionText = "¿Tu instalación necesita ser asegurada/tabicada?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 15, QuestionText = "¿No tienes energía comercial?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 16, QuestionText = "¿No tienes presión de agua?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 17, QuestionText = "¿No tienes teléfonos?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 18, QuestionText = "¿Los semáforos están dañados/faltan?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 19, QuestionText = "¿No tienes una alarma de incendios operativa?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 20, QuestionText = "¿No tienes un sistema de megafonía operativo?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 21, QuestionText = "¿Tienes una gran cantidad de escombros?", Language = "es" });
|
||||||
|
questionDbContext.QuestionsTranslations.Add(new Db.QuestionsTranslation() { QuestionId = 22, QuestionText = "¿Hay algún problema o asunto no abordado anteriormente que le impida abrir? Si es así, por favor explíquelo a continuación.", Language = "es" });
|
||||||
|
|
||||||
questionDbContext.SaveChanges();
|
questionDbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,6 +313,7 @@ namespace DamageAssesment.Api.Questions.Providers
|
|||||||
CategoryId = item.Id,
|
CategoryId = item.Id,
|
||||||
IconLibrary = item.IconLibrary,
|
IconLibrary = item.IconLibrary,
|
||||||
IconName = item.IconName,
|
IconName = item.IconName,
|
||||||
|
CategoryNames= CreateCategoryMultiLanguageObject(GetCategoryTranslations(item.Id, language)),
|
||||||
QuestionsText = GetSurveyQuestion(mapper.Map<List<Db.Question>, List<Models.MultiLanguage>>(questions.Where(a => a.CategoryId == item.Id).ToList()), language)
|
QuestionsText = GetSurveyQuestion(mapper.Map<List<Db.Question>, List<Models.MultiLanguage>>(questions.Where(a => a.CategoryId == item.Id).ToList()), language)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,5 +8,11 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"QuestionConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||||
|
// "QuestionConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;"
|
||||||
|
"QuestionConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="Moq" Version="4.18.4" />
|
<PackageReference Include="Moq" Version="4.18.4" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
@ -198,6 +198,7 @@ namespace DamageAssesment.Api.Responses.Controllers
|
|||||||
else
|
else
|
||||||
return BadRequest(result.ErrorMessage);
|
return BadRequest(result.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("responses/surveys/active")]
|
[Route("responses/surveys/active")]
|
||||||
[Route("responses/surveys/active/{language:alpha}")]
|
[Route("responses/surveys/active/{language:alpha}")]
|
||||||
[Route("responses/surveys/active/{employeeid:int}")]
|
[Route("responses/surveys/active/{employeeid:int}")]
|
||||||
@ -212,18 +213,7 @@ namespace DamageAssesment.Api.Responses.Controllers
|
|||||||
}
|
}
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
//[Route("responses/surveys/active")]
|
|
||||||
//[Route("responses/surveys/active/{language:alpha}")]
|
|
||||||
//[HttpGet]
|
|
||||||
//public async Task<ActionResult> GetActiveSurveysAsync( string? language)
|
|
||||||
//{
|
|
||||||
// var result = await this.surveyResponseProvider.GetActiveSurveysAsync(null, language);
|
|
||||||
// if (result.IsSuccess)
|
|
||||||
// {
|
|
||||||
// return Ok(result.Surveys);
|
|
||||||
// }
|
|
||||||
// return NoContent();
|
|
||||||
//}
|
|
||||||
[Route("responses/surveys/historic")]
|
[Route("responses/surveys/historic")]
|
||||||
[Route("responses/surveys/historic/{language:alpha}")]
|
[Route("responses/surveys/historic/{language:alpha}")]
|
||||||
[Route("responses/surveys/historic/{employeeid:int}")]
|
[Route("responses/surveys/historic/{employeeid:int}")]
|
||||||
|
@ -11,6 +11,19 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Responses.Db
|
namespace DamageAssesment.Api.Responses.Db
|
||||||
{
|
{
|
||||||
|
[Table("SurveyResponses")]
|
||||||
public class SurveyResponse
|
public class SurveyResponse
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -4,12 +4,17 @@ namespace DamageAssesment.Api.Responses.Db
|
|||||||
{
|
{
|
||||||
public class SurveyResponseDbContext:DbContext
|
public class SurveyResponseDbContext:DbContext
|
||||||
{
|
{
|
||||||
public DbSet<Db.SurveyResponse> SurveyResponses { get; set; }
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public SurveyResponseDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
public SurveyResponseDbContext(DbContextOptions options) : base(options)
|
|
||||||
{
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("ResponsesConnection"));
|
||||||
|
}
|
||||||
|
public DbSet<Db.SurveyResponse> SurveyResponses { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
});
|
});
|
||||||
builder.Services.AddDbContext<SurveyResponseDbContext>(option =>
|
builder.Services.AddDbContext<SurveyResponseDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Responses");
|
option.UseSqlServer("ResponsesConnection");
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ namespace DamageAssesment.Api.Responses.Providers
|
|||||||
//get all the survey that already taken by the employee
|
//get all the survey that already taken by the employee
|
||||||
var surveys = await surveyServiceProvider.getSurveysAsync(language);
|
var surveys = await surveyServiceProvider.getSurveysAsync(language);
|
||||||
surveys = surveys.Where(s => s.IsEnabled == true && s.StartDate <= DateTime.Now && s.EndDate >= DateTime.Now).ToList();
|
surveys = surveys.Where(s => s.IsEnabled == true && s.StartDate <= DateTime.Now && s.EndDate >= DateTime.Now).ToList();
|
||||||
if (employeeid==null || employeeid==0)
|
if (employeeid == null || employeeid == 0)
|
||||||
return (true, surveys, null);
|
return (true, surveys, null);
|
||||||
List<int> listOfsurveysId = await surveyResponseDbContext.SurveyResponses.Where(x => x.EmployeeId == employeeid.Value).Select(y => y.SurveyId).ToListAsync();
|
List<int> listOfsurveysId = await surveyResponseDbContext.SurveyResponses.Where(x => x.EmployeeId == employeeid.Value).Select(y => y.SurveyId).ToListAsync();
|
||||||
var activeSurveys = surveys.Where(s => !listOfsurveysId.Contains(s.Id));
|
var activeSurveys = surveys.Where(s => !listOfsurveysId.Contains(s.Id));
|
||||||
return (true, activeSurveys, null);
|
return (true, activeSurveys, null);
|
||||||
}
|
}
|
||||||
@ -142,10 +142,9 @@ namespace DamageAssesment.Api.Responses.Providers
|
|||||||
var surveys = await surveyServiceProvider.getSurveysAsync(language);
|
var surveys = await surveyServiceProvider.getSurveysAsync(language);
|
||||||
// returning only historic data: end date is less than current date.
|
// returning only historic data: end date is less than current date.
|
||||||
surveys = surveys.Where(s => s.EndDate < DateTime.Now).ToList();
|
surveys = surveys.Where(s => s.EndDate < DateTime.Now).ToList();
|
||||||
if(employeeid==null|| employeeid==0)
|
if (employeeid == null || employeeid == 0)
|
||||||
return (true, surveys, null);
|
return (true, surveys, null);
|
||||||
var surveyResponses = await surveyResponseDbContext.SurveyResponses.Where(x => x.EmployeeId == employeeid).ToListAsync();
|
var surveyResponses = await surveyResponseDbContext.SurveyResponses.Where(x => x.EmployeeId == employeeid).ToListAsync();
|
||||||
|
|
||||||
var historicSurveys = from s in surveys
|
var historicSurveys = from s in surveys
|
||||||
from r in surveyResponses
|
from r in surveyResponses
|
||||||
where s.Id == r.SurveyId
|
where s.Id == r.SurveyId
|
||||||
|
@ -39,5 +39,10 @@
|
|||||||
"AnswerByResponse": "/answers/byresponse/{0}",
|
"AnswerByResponse": "/answers/byresponse/{0}",
|
||||||
"Location": "/locations",
|
"Location": "/locations",
|
||||||
"Region": "/regions"
|
"Region": "/regions"
|
||||||
|
},
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"SurveyResponseConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||||
|
// "ResponsesConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;",
|
||||||
|
"ResponsesConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using DamageAssesment.Api.SurveyResponses.Db;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DamageAssesment.Api.SurveyResponses.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(SurveyResponseDbContext))]
|
||||||
|
[Migration("20230817221348_InitialSurveyResponse")]
|
||||||
|
partial class InitialSurveyResponse
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.9")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DamageAssesment.Api.SurveyResponses.Db.SurveyResponse", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("EmployeeId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(6)
|
||||||
|
.HasColumnType("nvarchar(6)");
|
||||||
|
|
||||||
|
b.Property<string>("LocationId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(4)
|
||||||
|
.HasColumnType("nvarchar(4)");
|
||||||
|
|
||||||
|
b.Property<int>("SurveyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SurveyResponses");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DamageAssesment.Api.SurveyResponses.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialSurveyResponse : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SurveyResponses",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SurveyId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LocationId = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
|
||||||
|
EmployeeId = table.Column<string>(type: "nvarchar(6)", maxLength: 6, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SurveyResponses", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SurveyResponses");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using DamageAssesment.Api.SurveyResponses.Db;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DamageAssesment.Api.SurveyResponses.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(SurveyResponseDbContext))]
|
||||||
|
partial class SurveyResponseDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.9")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DamageAssesment.Api.SurveyResponses.Db.SurveyResponse", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("EmployeeId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(6)
|
||||||
|
.HasColumnType("nvarchar(6)");
|
||||||
|
|
||||||
|
b.Property<string>("LocationId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(4)
|
||||||
|
.HasColumnType("nvarchar(4)");
|
||||||
|
|
||||||
|
b.Property<int>("SurveyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SurveyResponses");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Surveys.Db
|
namespace DamageAssesment.Api.Surveys.Db
|
||||||
{
|
{
|
||||||
|
[Table("Surveys")]
|
||||||
public class Survey
|
public class Survey
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace DamageAssesment.Api.Surveys.Db
|
namespace DamageAssesment.Api.Surveys.Db
|
||||||
{
|
{
|
||||||
|
[Table("SurveyTrans")]
|
||||||
public class SurveyTranslation
|
public class SurveyTranslation
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
|
@ -4,11 +4,18 @@ namespace DamageAssesment.Api.Surveys.Db
|
|||||||
{
|
{
|
||||||
public class SurveysDbContext : DbContext
|
public class SurveysDbContext : DbContext
|
||||||
{
|
{
|
||||||
|
private IConfiguration _Configuration { get; set; }
|
||||||
|
public SurveysDbContext(DbContextOptions options, IConfiguration configuration) : base(options)
|
||||||
|
{
|
||||||
|
_Configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
public DbSet<Db.Survey> Surveys { get; set; }
|
public DbSet<Db.Survey> Surveys { get; set; }
|
||||||
public DbSet<Db.SurveyTranslation> SurveysTranslation { get; set; }
|
public DbSet<Db.SurveyTranslation> SurveysTranslation { get; set; }
|
||||||
public SurveysDbContext(DbContextOptions options) : base(options)
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
{
|
{
|
||||||
|
// connect to sql server with connection string from app settings
|
||||||
|
options.UseSqlServer(_Configuration.GetConnectionString("SurveyConnection"));
|
||||||
}
|
}
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
});
|
});
|
||||||
builder.Services.AddDbContext<SurveysDbContext>(option =>
|
builder.Services.AddDbContext<SurveysDbContext>(option =>
|
||||||
{
|
{
|
||||||
option.UseInMemoryDatabase("Surveys");
|
option.UseSqlServer("SurveyConnection");
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace DamageAssesment.Api.Surveys.Providers
|
|||||||
this.surveyDbContext = surveysDbContext;
|
this.surveyDbContext = surveysDbContext;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
// seedData();
|
//seedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to seed initial data into the database
|
// Method to seed initial data into the database
|
||||||
@ -45,9 +45,9 @@ namespace DamageAssesment.Api.Surveys.Providers
|
|||||||
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey2.Id, Language = "es", Title = "Encuesta sobre las secuelas del huracán Andrew" });
|
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey2.Id, Language = "es", Title = "Encuesta sobre las secuelas del huracán Andrew" });
|
||||||
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey2.Id, Language = "fr", Title = "Enquête sur les conséquences de l'ouragan Andrew" });
|
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey2.Id, Language = "fr", Title = "Enquête sur les conséquences de l'ouragan Andrew" });
|
||||||
|
|
||||||
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "en", Title = "Hurricane Idalia Aftermath Survey" });
|
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "en", Title = "Hurricane Irma" });
|
||||||
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "es", Title = "Encuesta sobre las secuelas del huracán Idalia" });
|
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "es", Title = "Huracán Irma" });
|
||||||
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "fr", Title = "Enquête sur les conséquences de l'ouragan Idalia" });
|
surveyDbContext.SurveysTranslation.Add(new Db.SurveyTranslation { SurveyId = survey3.Id, Language = "fr", Title = "Ouragan Irma" });
|
||||||
|
|
||||||
surveyDbContext.SaveChanges();
|
surveyDbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,5 +8,10 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"SurveyConnection": "Server=DESKTOP-OF5DPLQ\\SQLEXPRESS;Database=da_survey_dev;Trusted_Connection=True;TrustServerCertificate=True;"
|
||||||
|
//"SurveyConnection": "Server=localhost,1433;Database=da_survey_dev;User Id=sa;Password=Password123;TrustServerCertificate=True;",
|
||||||
|
"SurveyConnection": "Server=207.180.248.35;Database=da_survey_dev;User Id=sa;Password=YourStrongPassw0rd;TrustServerCertificate=True;"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Attachm
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4CB40DC2-D9D2-4384-A7A6-9968F5C777A2}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4CB40DC2-D9D2-4384-A7A6-9968F5C777A2}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
..\..\..\..\Sample\Migrations.ps1 = ..\..\..\..\Sample\Migrations.ps1
|
||||||
ReadMe.txt = ReadMe.txt
|
ReadMe.txt = ReadMe.txt
|
||||||
ReadMe4Dev.txt = ReadMe4Dev.txt
|
ReadMe4Dev.txt = ReadMe4Dev.txt
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
trigger:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
pr:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-latest'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
chmod +x ./Scripts/build_and_push_services2acr.sh
|
|
||||||
./Scripts/build_and_push_services2acr.sh
|
|
||||||
displayName: 'Run build_and_push_services2acr.sh'
|
|
75
DamageAssesmentApi/docker-compose.acr.yml
Normal file
75
DamageAssesmentApi/docker-compose.acr.yml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
services:
|
||||||
|
damageassesment.api.answers:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapianswers
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Answers/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6001:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapianswers"
|
||||||
|
|
||||||
|
damageassesment.api.attachments:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapiattachments
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Attachments/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6001:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapiattachments"
|
||||||
|
|
||||||
|
damageassesment.api.employees:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapiemployees
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Employees/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6003:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapiemployees"
|
||||||
|
|
||||||
|
damageassesment.api.locations:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapilocations
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Locations/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6004:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapilocations"
|
||||||
|
|
||||||
|
damageassesment.api.questions:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapiquestions
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Questions/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6005:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapiquestions"
|
||||||
|
|
||||||
|
damageassesment.api.surveys:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapisurveys
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Surveys/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6006:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapisurveys"
|
||||||
|
|
||||||
|
damageassesment.api.doculinks:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapidoculinks
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.DocuLinks/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6008:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapidoculinks"
|
||||||
|
|
||||||
|
damageassesment.api.responses:
|
||||||
|
image: dadeschoolscontainerregistry.azurecr.io/damageassesmentapiresponses
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: DamageAssesment.Api.Responses/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "6007:80"
|
||||||
|
command: bash -c "docker push dadeschoolscontainerregistry.azurecr.io/damageassesmentapiresponses"
|
||||||
|
|
@ -9,6 +9,7 @@
|
|||||||
<DockerServiceName>damageassesment.api.answers</DockerServiceName>
|
<DockerServiceName>damageassesment.api.answers</DockerServiceName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="docker-compos.tst.yml" />
|
||||||
<None Include="docker-compose.sql.yml" />
|
<None Include="docker-compose.sql.yml" />
|
||||||
<None Include="docker-compose.asf.yml" />
|
<None Include="docker-compose.asf.yml" />
|
||||||
<None Include="docker-compose.override.yml">
|
<None Include="docker-compose.override.yml">
|
||||||
|
@ -1,78 +1,13 @@
|
|||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
answers:
|
|
||||||
image: santhoshsnair/damageassesmentapianswers:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6001:80"
|
|
||||||
|
|
||||||
attachments:
|
|
||||||
image: santhoshsnair/damageassesmentapiattachments:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6002:80"
|
|
||||||
|
|
||||||
|
|
||||||
employees:
|
|
||||||
image: santhoshsnair/damageassesmentapiemployees:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6003:80"
|
|
||||||
|
|
||||||
|
|
||||||
locations:
|
|
||||||
image: santhoshsnair/damageassesmentapilocations:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6004:80"
|
|
||||||
|
|
||||||
|
|
||||||
questions:
|
|
||||||
image: santhoshsnair/damageassesmentapiquestions:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6005:80"
|
|
||||||
|
|
||||||
|
|
||||||
responses:
|
|
||||||
image: santhoshsnair/damageassesmentapisurveyresponses:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
- services__Answers=http://10.0.0.4:19081/dasapp/answers/
|
|
||||||
- services__Locations=http://10.0.0.4:19081/dasapp/locations/
|
|
||||||
- services__Questions=http://10.0.0.4:19081/dasapp/questions/
|
|
||||||
- services__Employees=http://10.0.0.4:19081/dasapp/employees/
|
|
||||||
- services__Attachments=http://10.0.0.4:19081/dasapp/attachments/
|
|
||||||
- services__Surveys=http://10.0.0.4:19081/dasapp/survey/
|
|
||||||
|
|
||||||
ports:
|
|
||||||
- "6006:80"
|
|
||||||
|
|
||||||
|
|
||||||
surveys:
|
|
||||||
image: santhoshsnair/damageassesmentapisurveys:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6007:80"
|
|
||||||
|
|
||||||
|
|
||||||
doculinks:
|
|
||||||
image: santhoshsnair/damageassesmentapidoculinks:latest
|
|
||||||
environment:
|
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
|
||||||
ports:
|
|
||||||
- "6009:80"
|
|
||||||
sqlserver:
|
sqlserver:
|
||||||
image: mcr.microsoft.com/mssql/server:2019-latest
|
image: mcr.microsoft.com/mssql/server:2019-latest
|
||||||
environment:
|
environment:
|
||||||
- SA_PASSWORD=your_password
|
- SA_PASSWORD=Test123
|
||||||
- ACCEPT_EULA=Y
|
- ACCEPT_EULA=Y
|
||||||
ports:
|
ports:
|
||||||
- "1433:1433"
|
- "1433:1433"
|
||||||
|
volumes:
|
||||||
|
- ./data:/var/opt/mssql # Mount a volume to persist data
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
# powershell -ExecutionPolicy Bypass -File .\build_and_push_services2acr.ps1
|
|
||||||
# Specify the path to your docker-compose.yml
|
|
||||||
$composeFile = "C:\Users\santh\OneDrive\Desktop\DOCKERS\ubuntu\Sprint6\C1011\Backend-API-Services\DamageAssesmentApi\docker-compose.yml"
|
|
||||||
|
|
||||||
# List of services to build, tag, and push
|
|
||||||
$services = @(
|
|
||||||
"damageassesmentapianswers",
|
|
||||||
"damageassesmentapiattachments",
|
|
||||||
"damageassesmentapiemployees",
|
|
||||||
"damageassesmentapilocations",
|
|
||||||
"damageassesmentapiquestions",
|
|
||||||
"damageassesmentapisurveys",
|
|
||||||
"damageassesmentapidoculinks",
|
|
||||||
"damageassesmentapiresponses"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD)
|
|
||||||
docker login dadeschoolscontainerregistry.azurecr.io -u dadeSchoolsContainerRegistry -p k1f8hE0O5hj3tYCCR/5stNrkw5BZoTmAqid/hvaVo8+ACRDc2Arn
|
|
||||||
|
|
||||||
# Loop through the services and build, tag, and push
|
|
||||||
foreach ($service in $services) {
|
|
||||||
# Build the service
|
|
||||||
docker-compose -f $composeFile build $service
|
|
||||||
|
|
||||||
# Tag the image for ACR
|
|
||||||
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
|
|
||||||
|
|
||||||
# Push the image to ACR
|
|
||||||
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Determine the current directory (where the script is located)
|
|
||||||
script_directory="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
||||||
|
|
||||||
# Use the 'find' command to locate the 'docker-compose.yml' file within the repository directory
|
|
||||||
composeFile=$(find "$script_directory/.." -name "docker-compose.yml" -type f | head -n 1)
|
|
||||||
|
|
||||||
if [ -z "$composeFile" ]; then
|
|
||||||
echo "docker-compose.yml not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# List of services to build, tag, and push
|
|
||||||
services=(
|
|
||||||
"damageassesmentapianswers"
|
|
||||||
"damageassesmentapiattachments"
|
|
||||||
"damageassesmentapiemployees"
|
|
||||||
"damageassesmentapilocations"
|
|
||||||
"damageassesmentapiquestions"
|
|
||||||
"damageassesmentapisurveys"
|
|
||||||
"damageassesmentapidoculinks"
|
|
||||||
"damageassesmentapiresponses"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD)
|
|
||||||
docker login dadeschoolscontainerregistry.azurecr.io -u dadeSchoolsContainerRegistry -p k1f8hE0O5hj3tYCCR/5stNrkw5BZoTmAqid/hvaVo8+ACRDc2Arn
|
|
||||||
|
|
||||||
# Loop through the services and build, tag, and push
|
|
||||||
for service in "${services[@]}"; do
|
|
||||||
# Build the service
|
|
||||||
docker-compose -f "$composeFile" build "$service"
|
|
||||||
|
|
||||||
# Tag the image for ACR
|
|
||||||
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
|
|
||||||
|
|
||||||
# Push the image to ACR
|
|
||||||
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
|
|
||||||
done
|
|
39
db/migrate-sqldb_v1.ps1
Normal file
39
db/migrate-sqldb_v1.ps1
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Define the path to your application's root directory
|
||||||
|
$applicationRoot = "C:\Users\santh\OneDrive\Desktop\DOCKERS\ubuntu\Sprint6\C1011\Backend-API-Services\DamageAssesmentApi\"
|
||||||
|
#To execute: powershell -ExecutionPolicy Bypass -File .\migrate-sqldb.ps1
|
||||||
|
# Define the list of microservice directories
|
||||||
|
$microservices = @(
|
||||||
|
"DamageAssesment.Api.Answers",
|
||||||
|
"DamageAssesment.Api.Attachments",
|
||||||
|
"DamageAssesment.Api.DocuLinks",
|
||||||
|
"DamageAssesment.Api.Employees",
|
||||||
|
"DamageAssesment.Api.Locations",
|
||||||
|
"DamageAssesment.Api.Questions",
|
||||||
|
"DamageAssesment.Api.Responses",
|
||||||
|
"DamageAssesment.Api.Surveys"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Define the migration name with the current date and time
|
||||||
|
$migrationName = "Migration_" + (Get-Date -Format "yyyyMMdd_HHmmss")
|
||||||
|
|
||||||
|
# Function to run migrations for a microservice
|
||||||
|
Function Run-Migrations {
|
||||||
|
param (
|
||||||
|
[string]$microservicePath
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "Running Migrations for $microservicePath..."
|
||||||
|
Set-Location -Path $microservicePath
|
||||||
|
dotnet ef migrations add $migrationName
|
||||||
|
dotnet ef database update
|
||||||
|
Write-Host "Migrations for $microservicePath completed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run migrations for each microservice
|
||||||
|
$microservices | ForEach-Object {
|
||||||
|
$microservicePath = Join-Path -Path $applicationRoot -ChildPath $_
|
||||||
|
Run-Migrations -microservicePath $microservicePath
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All Migrations Completed."
|
Loading…
Reference in New Issue
Block a user