Fix for Data seed issue,Url Correction for SurveyResponses

This commit is contained in:
Santhosh S
2023-09-04 15:40:10 -04:00
parent af004ce565
commit a52f6e0cf9
30 changed files with 146 additions and 76 deletions

View File

@ -4,5 +4,6 @@
{
Task<(bool IsSuccess, Db.QuestionType QuestionType, string ErrorMessage)> GetQuestionTypeAsync(int Id);
Task<(bool IsSuccess, IEnumerable<Db.QuestionType> QuestionTypes, string ErrorMessage)> GetQuestionTypesAsync();
}
}

View File

@ -17,5 +17,6 @@ namespace DamageAssesment.Api.Questions.Interfaces
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> PostQuestionCategoryAsync(Models.QuestionCategory QuestionCategory);
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> UpdateQuestionCategoryAsync(Models.QuestionCategory QuestionCategory);
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> DeleteQuestionCategoryAsync(int Id);
void SeedData();
}
}

View File

@ -35,8 +35,20 @@ var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
using (var serviceScope = app.Services.CreateScope())
{
var services = serviceScope.ServiceProvider;
var questionProvider = services.GetRequiredService<IQuestionsProvider>();
questionProvider.SeedData();
}
app.UseSwagger();
app.UseSwaggerUI(options => { options.SwaggerEndpoint("/questions/swagger/v1/swagger.json", ""); });
app.UseSwaggerUI(options => {
//switch for local environment
options.SwaggerEndpoint("/swagger/v1/swagger.json", "");
// options.SwaggerEndpoint("/questions/swagger/v1/swagger.json", "");
});
}
app.UseAuthorization();

View File

@ -21,10 +21,10 @@ namespace DamageAssesment.Api.Questions.Providers
this.questionDbContext = questionDbContext;
this.logger = logger;
this.mapper = mapper;
SeedData();
// SeedData();
}
private void SeedData()
public void SeedData()
{
if (!questionDbContext.QuestionsTranslations.Any())