Skip to content
Snippets Groups Projects
Commit 193b2cc0 authored by Adam Štěpánek's avatar Adam Štěpánek
Browse files

Rename ProjectFilter.AccountId to AccessingAccountId

parent 1675e654
No related branches found
No related tags found
1 merge request!23Replace Capabilities with Permissions
......@@ -39,7 +39,7 @@ public class ProjectListEndpoint : EndpointBaseAsync
public override async Task<ActionResult<ImmutableArray<ProjectListDto>>> HandleAsync(
CancellationToken cancellationToken = default)
{
var projects = await projectService.List(new(AccountId: userProvider.Account?.Id), cancellationToken);
var projects = await projectService.List(new(AccessingAccountId: userProvider.Account?.Id), cancellationToken);
return Ok(projects.Select(TransferMaps.ToProjectListDto).ToImmutableArray());
}
}
......@@ -164,7 +164,7 @@ public partial class ProjectService
public record ProjectFilter(
Hrib? ProjectGroupId = null,
Hrib? AccountId = null
Hrib? AccessingAccountId = null
);
public async Task<ImmutableArray<ProjectInfo>> List(ProjectFilter? filter = null, CancellationToken token = default)
......@@ -173,12 +173,12 @@ public partial class ProjectService
var query = db.Query<ProjectInfo>();
if (filter.AccountId is not null)
if (filter.AccessingAccountId is not null)
{
query = (IMartenQueryable<ProjectInfo>)query
.Where(e => e.MatchesSql(
$"({SqlFunctions.GetProjectPerms}(data ->> 'Id', ?) & ?) != 0",
filter.AccountId.Value,
filter.AccessingAccountId.Value,
(int)Permission.Read));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment