feat: public projects, project deletion and sagas
Public projects:
- Project.isPublic (create/update, owners and admins). Anyone can read a
public project without a token: project, board, tickets, comments,
history, releases, activity, tracking and statistics, over GraphQL and
REST. Writes stay for members (401 anonymous, 403 outsiders).
- @OptionalAuth() / @ApiOptionalPireonAuth(): anonymous callers allowed,
invalid tokens still rejected. ReadAccess lets anonymous viewers read
public projects only; linked tickets are filtered by visibility.
- publicProjects (GraphQL) and GET /api/explore/projects (REST).
- Web: «Explorar» page, project pages open without a session (read-only
notice, sign-in hints), public badge, visibility switch in settings,
no realtime subscriptions without a session.
Project deletion:
- Owner only, confirming the key (deleteProject / DELETE
/api/projects/{project}?confirm=KEY). The key is freed; the read model
drops the project and members are notified (web goes home).
Sagas (run by the EventsBridge after projections, durable and ordered):
- ProjectDeletionSaga: project deleted → delete its tickets and releases;
ticket deleted → purge its comments and drop links from other tickets.
- ReleaseArchivedSaga: unfinished tickets leave an archived release.
- UserDeactivatedSaga: the Pireon webhook records UserDeactivatedEvent in
the event store (EventRecorder); the tracker unassigns that user's open
tickets as the system actor.
- Internal idempotent commands; domain refusals are logged and skipped,
concurrency conflicts retried. Affected streams come from the event store
(TrackerStreamsRepository).
Tests: domain lifecycle specs, saga specs run like the bridge, facade
tests, e2e for public access, cascade deletion, archived releases and
deactivation webhook. Docs, READMEs, schema.gql/openapi.json and Word/PDF
updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,14 +6,20 @@ import {
|
||||
inject,
|
||||
input,
|
||||
} from '@angular/core';
|
||||
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
||||
import {
|
||||
Router,
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
RouterOutlet,
|
||||
} from '@angular/router';
|
||||
import { AuthFacade } from '@task-stream/web/identity/application';
|
||||
import { PiNoteComponent, PiSpinnerComponent } from '@pi/ui';
|
||||
import {
|
||||
ProjectFacade,
|
||||
provideProjectFacade,
|
||||
} from '@task-stream/web/tracker/application';
|
||||
import { AvatarsComponent } from '../ui/avatars';
|
||||
import { projectTone, ROLE } from '../ui/copy';
|
||||
import { projectTone, PUBLIC_TONE, ROLE } from '../ui/copy';
|
||||
|
||||
/** /p/:key — loads the project once for all its tabs (its store and facade are scoped here). */
|
||||
@Component({
|
||||
@@ -33,11 +39,18 @@ import { projectTone, ROLE } from '../ui/copy';
|
||||
<header class="ts-project-header" [style.--tone]="tone(project.key)">
|
||||
<div class="ts-project-header__main">
|
||||
<p class="ts-eyebrow">
|
||||
<a class="ts-plain-link" routerLink="/">Proyectos</a> /
|
||||
@if (auth.isAuthenticated()) {
|
||||
<a class="ts-plain-link" routerLink="/">Proyectos</a> /
|
||||
} @else {
|
||||
<a class="ts-plain-link" routerLink="/explorar">Explorar</a> /
|
||||
}
|
||||
{{ project.key }}
|
||||
@if (facade.myRole(); as role) {
|
||||
· {{ roleLabel(role) }}
|
||||
}
|
||||
@if (project.isPublic) {
|
||||
<span class="ts-pill" [style.--tone]="publicTone">Público</span>
|
||||
}
|
||||
</p>
|
||||
<h1>
|
||||
<span class="ts-project-header__key">{{ project.key }}</span>
|
||||
@@ -56,6 +69,20 @@ import { projectTone, ROLE } from '../ui/copy';
|
||||
>
|
||||
</div>
|
||||
</header>
|
||||
@if (!facade.myRole()) {
|
||||
<p class="ts-readonly" role="note">
|
||||
Proyecto público: lo estás viendo en modo lectura.
|
||||
@if (!auth.isAuthenticated()) {
|
||||
<a
|
||||
class="ts-plain-link"
|
||||
routerLink="/login"
|
||||
[queryParams]="{ returnUrl: url() }"
|
||||
>Inicia sesión</a
|
||||
>
|
||||
si eres del equipo.
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<nav class="ts-tabs" aria-label="Secciones del proyecto">
|
||||
<a routerLink="board" routerLinkActive="is-active">Tablero</a>
|
||||
<a routerLink="releases" routerLinkActive="is-active">Releases</a>
|
||||
@@ -77,8 +104,26 @@ import { projectTone, ROLE } from '../ui/copy';
|
||||
appearance="fill"
|
||||
type="status"
|
||||
title="No se pudo abrir el proyecto"
|
||||
[text]="error"
|
||||
[text]="
|
||||
auth.isAuthenticated()
|
||||
? error
|
||||
: 'No existe o no es público. Si es de tu equipo, inicia sesión.'
|
||||
"
|
||||
/>
|
||||
@if (!auth.isAuthenticated()) {
|
||||
<p class="ts-center-actions">
|
||||
<a
|
||||
class="ts-plain-link"
|
||||
routerLink="/login"
|
||||
[queryParams]="{ returnUrl: url() }"
|
||||
>Iniciar sesión</a
|
||||
>
|
||||
·
|
||||
<a class="ts-plain-link" routerLink="/explorar"
|
||||
>Ver proyectos públicos</a
|
||||
>
|
||||
</p>
|
||||
}
|
||||
} @else {
|
||||
<div class="ts-center">
|
||||
<pi-spinner [isLoading]="true" [diameter]="40" />
|
||||
@@ -86,6 +131,33 @@ import { projectTone, ROLE } from '../ui/copy';
|
||||
}
|
||||
`,
|
||||
styles: `
|
||||
.ts-eyebrow .ts-pill {
|
||||
margin-left: 0.5rem;
|
||||
letter-spacing: 0;
|
||||
text-transform: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.ts-readonly {
|
||||
margin: 1rem 0 0;
|
||||
padding: 0.625rem 0.875rem;
|
||||
border-radius: 0.625rem;
|
||||
background: color-mix(in srgb, var(--ts-c-teal) 8%, var(--ts-surface));
|
||||
border: 1px solid color-mix(in srgb, var(--ts-c-teal) 25%, transparent);
|
||||
font-size: 0.875rem;
|
||||
color: var(--ts-ink-soft);
|
||||
a {
|
||||
font-weight: 600;
|
||||
color: var(--ts-brand);
|
||||
}
|
||||
}
|
||||
.ts-center-actions {
|
||||
margin: 1rem 0 0;
|
||||
font-size: 0.875rem;
|
||||
a {
|
||||
font-weight: 600;
|
||||
color: var(--ts-brand);
|
||||
}
|
||||
}
|
||||
.ts-project-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
@@ -138,6 +210,11 @@ export class ProjectShellPage {
|
||||
readonly key = input.required<string>();
|
||||
|
||||
protected readonly facade = inject(ProjectFacade);
|
||||
protected readonly auth = inject(AuthFacade);
|
||||
private readonly router = inject(Router);
|
||||
protected readonly publicTone = PUBLIC_TONE;
|
||||
/** Where to come back after signing in. */
|
||||
protected readonly url = () => this.router.url;
|
||||
protected readonly roleLabel = (role: keyof typeof ROLE) => ROLE[role];
|
||||
protected readonly tone = projectTone;
|
||||
protected readonly memberNames = computed(() =>
|
||||
|
||||
Reference in New Issue
Block a user