chore: moving towards agentic development
Some checks failed
Backend CI/CD / build_and_deploy (push) Has been cancelled
Frontend CI/CD / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 21:12:26 -04:00
parent df3e602015
commit b6eb692c27
179 changed files with 2880 additions and 866 deletions

View File

@@ -0,0 +1,46 @@
using Socialize.Infrastructure.Security;
using Socialize.Modules.Workspaces.Data;
namespace Socialize.Modules.Workspaces.Handlers;
public record WorkspaceDto(
Guid Id,
string Name,
string Slug,
string TimeZone,
DateTimeOffset CreatedAt);
public class GetWorkspacesHandler(
AppDbContext dbContext,
AccessScopeService accessScopeService)
: EndpointWithoutRequest<IReadOnlyCollection<WorkspaceDto>>
{
public override void Configure()
{
Get("/api/workspaces");
Options(o => o.WithTags("Workspaces"));
}
public override async Task HandleAsync(CancellationToken ct)
{
IQueryable<Workspace> query = dbContext.Workspaces.AsQueryable();
if (!accessScopeService.IsManager(User))
{
IReadOnlyCollection<Guid> workspaceScopeIds = User.GetWorkspaceScopeIds();
query = query.Where(workspace => workspaceScopeIds.Contains(workspace.Id));
}
List<WorkspaceDto> workspaces = await query
.OrderBy(workspace => workspace.Name)
.Select(workspace => new WorkspaceDto(
workspace.Id,
workspace.Name,
workspace.Slug,
workspace.TimeZone,
workspace.CreatedAt))
.ToListAsync(ct);
await SendOkAsync(workspaces, ct);
}
}