-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
641902d
commit 1d5e603
Showing
8 changed files
with
80 additions
and
59 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 was deleted.
Oops, something went wrong.
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,33 @@ | ||
namespace SIL.Machine.AspNetCore.Models; | ||
|
||
public record SortableIndex : IEntity | ||
{ | ||
public string Id { get; set; } = ""; | ||
|
||
public int Revision { get; set; } | ||
|
||
public string Context { get; set; } = ""; | ||
public int CurrentIndex { get; set; } | ||
|
||
public static string IndexToObjectIdString(int value) | ||
{ | ||
return value.ToString("x24"); | ||
} | ||
|
||
public static async Task<string> GetSortableIndexAsync( | ||
IRepository<SortableIndex> indexRepository, | ||
string context, | ||
CancellationToken cancellationToken | ||
) | ||
{ | ||
SortableIndex outboxIndex = ( | ||
await indexRepository.UpdateAsync( | ||
i => i.Context == context, | ||
i => i.Inc(b => b.CurrentIndex, 1), | ||
upsert: true, | ||
cancellationToken: cancellationToken | ||
) | ||
)!; | ||
return IndexToObjectIdString(outboxIndex.CurrentIndex); | ||
} | ||
} |
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