case 4221

This commit is contained in:
2022-10-26 20:01:51 +00:00
parent 12aa3b16fb
commit 0a80ceaf1c
3 changed files with 35 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Seed a trial database with sample data.
///
/// NOTE: the database must be erased prior to seeding
/// You can control the size and scope of the seeded data with the passed in size value
/// "Small" - a small one man shop dataset
/// "Medium" - Local service company with multiple employees and departments dataset
@@ -71,6 +71,13 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Current license is not a trial license key. Only a trial can be seeded."));
}
//if db not empty then can't seed
if (!await DbUtil.DBIsEmptyAsync(ct, log))
{
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Current database is not empty. Only an empty database can be seeded."));
}
Seeder.Level.SeedLevel seedLevel = Seeder.Level.StringToSeedLevel(seedOptions.SeedLevel);
if (seedLevel == Seeder.Level.SeedLevel.NotValid)
return BadRequest(new ApiErrorResponse(ApiErrorCode.NOT_FOUND, "size", "Valid values are \"small\", \"medium\", \"large\", \"huge\""));
@@ -82,8 +89,8 @@ namespace AyaNova.Api.Controllers
seedLevel = seedLevel,
timeZoneOffset = seedOptions.TimeZoneOffset,
e2e = seedOptions.E2e,
forceEmail=seedOptions.ForceEmail,
appendPassword=seedOptions.AppendPassword
forceEmail = seedOptions.ForceEmail,
appendPassword = seedOptions.AppendPassword
});
OpsJob j = new OpsJob();