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:
@@ -22,6 +22,9 @@ type ChipColor =
|
||||
/** CSS colour of a settings colour token (`--ts-c-*` in styles.scss). */
|
||||
export const tone = (color: string) => `var(--ts-c-${color}, var(--ts-muted))`;
|
||||
|
||||
/** Badge of public projects (readable without signing in). */
|
||||
export const PUBLIC_TONE = tone('teal');
|
||||
|
||||
/** A status as the UI shows it: the project's name and colour. */
|
||||
export function statusLook(workflow: Workflow, id: string) {
|
||||
const status = workflow.status(id);
|
||||
|
||||
126
libs/web/tracker/presenters/src/lib/ui/project-card.ts
Normal file
126
libs/web/tracker/presenters/src/lib/ui/project-card.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
computed,
|
||||
input,
|
||||
} from '@angular/core';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Project } from '@task-stream/web/tracker/domain';
|
||||
import { AvatarsComponent } from './avatars';
|
||||
import { projectTone, PUBLIC_TONE, timeAgo } from './copy';
|
||||
|
||||
/** A project in a list (my projects, public projects): key, name, team. */
|
||||
@Component({
|
||||
selector: 'ts-project-card',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [RouterLink, AvatarsComponent],
|
||||
template: `
|
||||
<a
|
||||
class="ts-project ts-card-link"
|
||||
[routerLink]="['/p', project().key]"
|
||||
[style.--tone]="tone()"
|
||||
>
|
||||
<div class="ts-project__top">
|
||||
<span class="ts-project__key">{{ project().key }}</span>
|
||||
@if (project().isPublic) {
|
||||
<span class="ts-pill" [style.--tone]="publicTone">Público</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()" />
|
||||
<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>
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
.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: center;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
.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 {
|
||||
margin-left: auto;
|
||||
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 ProjectCardComponent {
|
||||
readonly project = input.required<Project>();
|
||||
protected readonly tone = computed(() => projectTone(this.project().key));
|
||||
protected readonly memberNames = computed(() =>
|
||||
this.project().members.map((m) => m.user.name),
|
||||
);
|
||||
protected readonly ago = timeAgo;
|
||||
protected readonly publicTone = PUBLIC_TONE;
|
||||
}
|
||||
Reference in New Issue
Block a user