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:
@@ -15,7 +15,6 @@ import {
|
||||
pattern,
|
||||
required,
|
||||
} from '@angular/forms/signals';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import {
|
||||
PiActionButtonComponent,
|
||||
PiEmptyStateComponent,
|
||||
@@ -27,19 +26,17 @@ import {
|
||||
import { DrawerService } from '@task-stream/web/shared/ui';
|
||||
import { ProjectsFacade } from '@task-stream/web/tracker/application';
|
||||
import { AuthFacade } from '@task-stream/web/identity/application';
|
||||
import { AvatarsComponent } from '../ui/avatars';
|
||||
import { GoToComponent } from '../ui/go-to';
|
||||
import { ProjectCardComponent } from '../ui/project-card';
|
||||
import { MyWorkComponent } from './my-work';
|
||||
import { projectTone, timeAgo } from '../ui/copy';
|
||||
|
||||
@Component({
|
||||
selector: 'ts-projects-page',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [
|
||||
RouterLink,
|
||||
FormField,
|
||||
AvatarsComponent,
|
||||
GoToComponent,
|
||||
ProjectCardComponent,
|
||||
MyWorkComponent,
|
||||
PiActionButtonComponent,
|
||||
PiEmptyStateComponent,
|
||||
@@ -101,32 +98,7 @@ import { projectTone, timeAgo } from '../ui/copy';
|
||||
} @else {
|
||||
<div class="ts-projects">
|
||||
@for (project of facade.sorted(); track project.id) {
|
||||
<a
|
||||
class="ts-project ts-card-link"
|
||||
[routerLink]="['/p', project.key]"
|
||||
[style.--tone]="tone(project.key)"
|
||||
>
|
||||
<div class="ts-project__top">
|
||||
<span class="ts-project__key">{{ project.key }}</span>
|
||||
<span class="ts-project__updated ts-mono">{{
|
||||
ago(project.updatedAt)
|
||||
}}</span>
|
||||
</div>
|
||||
<h2 class="ts-project__name">{{ project.name }}</h2>
|
||||
@if (project.description) {
|
||||
<p class="ts-project__description">{{ project.description }}</p>
|
||||
}
|
||||
<div class="ts-project__bottom">
|
||||
<ts-avatars [names]="memberNames(project.members)" />
|
||||
<span class="ts-project__count ts-mono"
|
||||
>{{ project.members.length }}
|
||||
{{
|
||||
project.members.length === 1 ? 'persona' : 'personas'
|
||||
}}</span
|
||||
>
|
||||
<span class="ts-project__go" aria-hidden="true">→</span>
|
||||
</div>
|
||||
</a>
|
||||
<ts-project-card [project]="project" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -151,6 +123,14 @@ import { projectTone, timeAgo } from '../ui/copy';
|
||||
>
|
||||
<pi-label>Descripción</pi-label>
|
||||
</pi-textarea>
|
||||
<label class="ts-public-check">
|
||||
<input type="checkbox" [formField]="f.isPublic" />
|
||||
<span>
|
||||
<strong>Proyecto público</strong>
|
||||
Cualquiera, también sin iniciar sesión, podrá verlo (solo lectura).
|
||||
Se puede cambiar después en Configuración.
|
||||
</span>
|
||||
</label>
|
||||
<pi-action-button
|
||||
size="w100"
|
||||
color="primary"
|
||||
@@ -183,77 +163,30 @@ import { projectTone, timeAgo } from '../ui/copy';
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
.ts-public-check {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.625rem;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--ts-muted);
|
||||
cursor: pointer;
|
||||
input {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
margin-top: 0.125rem;
|
||||
accent-color: var(--ts-brand);
|
||||
}
|
||||
strong {
|
||||
display: block;
|
||||
color: var(--ts-ink);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
.ts-projects {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
|
||||
gap: 1.25rem;
|
||||
}
|
||||
.ts-project {
|
||||
display: grid;
|
||||
grid-template-rows: auto auto 1fr auto;
|
||||
gap: 0.375rem;
|
||||
min-height: 12rem;
|
||||
padding: 1.5rem 1.5rem 1.25rem;
|
||||
&:hover .ts-project__go {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
.ts-project__top {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
.ts-project__key {
|
||||
font-family: var(--ts-font-mono);
|
||||
font-size: 1.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.04em;
|
||||
color: var(--tone);
|
||||
}
|
||||
.ts-project__updated {
|
||||
font-size: 0.75rem;
|
||||
color: var(--ts-muted);
|
||||
}
|
||||
.ts-project__name {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.ts-project__description {
|
||||
margin: 0;
|
||||
color: var(--ts-muted);
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.45;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ts-project__bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
margin-top: 0.75rem;
|
||||
padding-top: 0.875rem;
|
||||
border-top: 1px dashed var(--ts-line);
|
||||
}
|
||||
.ts-project__count {
|
||||
font-size: 0.75rem;
|
||||
color: var(--ts-muted);
|
||||
}
|
||||
.ts-project__go {
|
||||
margin-left: auto;
|
||||
font-size: 1.125rem;
|
||||
color: var(--tone);
|
||||
opacity: 0;
|
||||
transform: translateX(-4px);
|
||||
transition:
|
||||
opacity 0.18s ease,
|
||||
transform 0.18s ease;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class ProjectsPage implements OnInit {
|
||||
@@ -266,7 +199,12 @@ export class ProjectsPage implements OnInit {
|
||||
private readonly createForm =
|
||||
viewChild.required<TemplateRef<unknown>>('createForm');
|
||||
|
||||
private readonly model = signal({ key: '', name: '', description: '' });
|
||||
private readonly model = signal({
|
||||
key: '',
|
||||
name: '',
|
||||
description: '',
|
||||
isPublic: false,
|
||||
});
|
||||
protected readonly f = form(this.model, (p) => {
|
||||
required(p.key);
|
||||
pattern(p.key, /^[A-Za-z][A-Za-z0-9]{1,9}$/, {
|
||||
@@ -276,28 +214,25 @@ export class ProjectsPage implements OnInit {
|
||||
maxLength(p.name, 120);
|
||||
});
|
||||
|
||||
protected readonly ago = timeAgo;
|
||||
protected readonly tone = projectTone;
|
||||
protected readonly pad = (n: number) => String(n).padStart(2, '0');
|
||||
protected readonly memberNames = (members: { user: { name: string } }[]) =>
|
||||
members.map((m) => m.user.name);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.facade.load();
|
||||
}
|
||||
|
||||
protected openCreate(): void {
|
||||
this.model.set({ key: '', name: '', description: '' });
|
||||
this.model.set({ key: '', name: '', description: '', isPublic: false });
|
||||
this.drawer.open('Nuevo proyecto', this.createForm());
|
||||
}
|
||||
|
||||
protected create(): void {
|
||||
if (this.f().invalid()) return;
|
||||
const { key, name, description } = this.model();
|
||||
const { key, name, description, isPublic } = this.model();
|
||||
this.facade.create({
|
||||
key: key.toUpperCase(),
|
||||
name,
|
||||
description: description || null,
|
||||
isPublic,
|
||||
});
|
||||
this.drawer.closeAll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user