-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use project ID, not code, in CrdtMerge API (#1169)
* Revisit filenames we use for CrdtMerge Use project code and ID in root folder name, use "crdt" and "fw" inside root folder no matter what the project's actual code or name is. * Update CRDT caching so same filename isn't a problem Using the name "crdt" everywhere as a project name caused a couple of caching issues in existing CRDT code, but the change is pretty easy. * Now use project ID, not code, in CrdtMerge API Old URL: /sync?projectCode=sena-3 New URL: /sync?projectId=(guid) --------- Co-authored-by: Kevin Hahn <[email protected]>
- Loading branch information
Showing
14 changed files
with
101 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using LexData; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace CrdtMerge; | ||
|
||
public class ProjectLookupService(LexBoxDbContext dbContext) | ||
{ | ||
public async ValueTask<string?> GetProjectCode(Guid projectId) | ||
{ | ||
var projectCode = await dbContext.Projects | ||
.Where(p => p.Id == projectId) | ||
.Select(p => p.Code) | ||
.FirstOrDefaultAsync(); | ||
return projectCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.Data.Sqlite; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace LcmCrdt.Tests; | ||
|
||
public class OpenProjectTests | ||
{ | ||
[Fact] | ||
public async Task OpeningAProjectWorks() | ||
{ | ||
var sqliteConnectionString = "OpeningAProjectWorks.sqlite"; | ||
var builder = Host.CreateEmptyApplicationBuilder(null); | ||
builder.Services.AddLcmCrdtClient(); | ||
using var host = builder.Build(); | ||
var services = host.Services; | ||
var asyncScope = services.CreateAsyncScope(); | ||
await asyncScope.ServiceProvider.GetRequiredService<ProjectsService>() | ||
.CreateProject(new(Name: "OpeningAProjectWorks", Path: "")); | ||
|
||
var miniLcmApi = (CrdtMiniLcmApi)await asyncScope.ServiceProvider.OpenCrdtProject(new CrdtProject("OpeningAProjectWorks", sqliteConnectionString)); | ||
miniLcmApi.ProjectData.Name.Should().Be("OpeningAProjectWorks"); | ||
|
||
await asyncScope.ServiceProvider.GetRequiredService<LcmCrdtDbContext>().Database.EnsureDeletedAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters