Skip to content

Commit

Permalink
change seeding data default when creating a new CRDT project
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Nov 6, 2024
1 parent 166b4d2 commit 935c565
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task InitializeAsync()
if (Path.Exists(crdtProjectsFolder)) Directory.Delete(crdtProjectsFolder, true);
Directory.CreateDirectory(crdtProjectsFolder);
var crdtProject = await _services.ServiceProvider.GetRequiredService<ProjectsService>()
.CreateProject(new(_projectName, FwProjectId: FwDataApi.ProjectId));
.CreateProject(new(_projectName, FwProjectId: FwDataApi.ProjectId, SeedNewProjectData: true));
CrdtApi = (CrdtMiniLcmApi) await _services.ServiceProvider.OpenCrdtProject(crdtProject);
}

Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/LcmCrdt.Tests/OpenProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public async Task OpeningAProjectWorks()
var services = host.Services;
var asyncScope = services.CreateAsyncScope();
await asyncScope.ServiceProvider.GetRequiredService<ProjectsService>()
.CreateProject(new(Name: "OpeningAProjectWorks", Path: ""));
.CreateProject(new(Name: "OpeningAProjectWorks", Path: "", SeedNewProjectData: true));

var miniLcmApi = (CrdtMiniLcmApi)await asyncScope.ServiceProvider.OpenCrdtProject(new CrdtProject("OpeningAProjectWorks", sqliteConnectionString));
miniLcmApi.ProjectData.Name.Should().Be("OpeningAProjectWorks");
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/LcmCrdt/ProjectsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public record CreateProjectRequest(
Guid? Id = null,
Uri? Domain = null,
Func<IServiceProvider, CrdtProject, Task>? AfterCreate = null,
bool SeedNewProjectData = true,
bool SeedNewProjectData = false,
string? Path = null,
Guid? FwProjectId = null);

Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/LocalWebApp/Routes/ProjectRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static IEndpointConventionBuilder MapProjectRoutes(this WebApplication ap
return Results.BadRequest("Project already exists");
if (!ProjectName().IsMatch(name))
return Results.BadRequest("Only letters, numbers, '-' and '_' are allowed");
await projectService.CreateProject(new(name, AfterCreate: AfterCreate));
await projectService.CreateProject(new(name, AfterCreate: AfterCreate, SeedNewProjectData: true));
return TypedResults.Ok();
});
group.MapPost($"/upload/crdt/{{serverAuthority}}/{{{CrdtMiniLcmApiHub.ProjectRouteKey}}}",
Expand Down

0 comments on commit 935c565

Please sign in to comment.