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:
@@ -80,6 +80,38 @@ function idFrom(name: string): string {
|
||||
/>
|
||||
}
|
||||
|
||||
@if (facade.project(); as project) {
|
||||
<section
|
||||
class="ts-panel ts-block ts-visibility"
|
||||
aria-labelledby="vis-title"
|
||||
>
|
||||
<div>
|
||||
<h3 id="vis-title">Visibilidad</h3>
|
||||
<p class="ts-muted">
|
||||
@if (project.isPublic) {
|
||||
Público: cualquiera, también sin iniciar sesión, ve el tablero,
|
||||
los tickets, los comentarios, las releases, la actividad y las
|
||||
estadísticas (en la web, por GraphQL y por REST). Solo los
|
||||
miembros pueden cambiar algo.
|
||||
} @else {
|
||||
Privado: solo los miembros del proyecto lo ven.
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
<label class="ts-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
[checked]="project.isPublic"
|
||||
[disabled]="!facade.canManage()"
|
||||
(change)="facade.setPublic($any($event.target).checked)"
|
||||
/>
|
||||
<span class="ts-switch__track" aria-hidden="true"></span>
|
||||
<span>{{ project.isPublic ? 'Público' : 'Privado' }}</span>
|
||||
</label>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (draft(); as d) {
|
||||
<form
|
||||
class="ts-settings"
|
||||
@@ -412,6 +444,47 @@ function idFrom(name: string): string {
|
||||
</footer>
|
||||
}
|
||||
</form>
|
||||
|
||||
@if (facade.isOwner() && facade.project(); as project) {
|
||||
<section
|
||||
class="ts-panel ts-block ts-danger"
|
||||
aria-labelledby="danger-title"
|
||||
>
|
||||
<div>
|
||||
<h3 id="danger-title">Eliminar el proyecto</h3>
|
||||
<p class="ts-muted">
|
||||
Se borran sus tickets, comentarios y releases, y los enlaces que
|
||||
tickets de otros proyectos tengan hacia los suyos. La clave
|
||||
{{ project.key }} queda libre. No se puede deshacer.
|
||||
</p>
|
||||
</div>
|
||||
<div class="ts-danger__confirm">
|
||||
<label class="ts-danger__label">
|
||||
<span
|
||||
>Escribe <code>{{ project.key }}</code> para confirmar</span
|
||||
>
|
||||
<input
|
||||
class="ts-input"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
[value]="confirmKey()"
|
||||
(input)="confirmKey.set($any($event.target).value)"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
class="ts-delete"
|
||||
[disabled]="
|
||||
confirmKey().trim().toUpperCase() !== project.key ||
|
||||
facade.deleting()
|
||||
"
|
||||
(click)="facade.deleteProject(confirmKey())"
|
||||
>
|
||||
{{ facade.deleting() ? 'Eliminando…' : 'Eliminar proyecto' }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
|
||||
<ng-template
|
||||
@@ -452,10 +525,120 @@ function idFrom(name: string): string {
|
||||
</ng-template>
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
.ts-block.ts-visibility,
|
||||
.ts-block.ts-danger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
> div {
|
||||
flex: 1 1 26rem;
|
||||
}
|
||||
p {
|
||||
max-width: 46rem;
|
||||
margin: 0.25rem 0 0;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
}
|
||||
.ts-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
input:focus-visible + .ts-switch__track {
|
||||
outline: 2px solid var(--ts-brand);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
input:disabled ~ * {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
.ts-switch__track {
|
||||
position: relative;
|
||||
width: 2.5rem;
|
||||
height: 1.375rem;
|
||||
border-radius: 999px;
|
||||
background: var(--ts-line-strong);
|
||||
transition: background-color 0.15s ease;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border-radius: 50%;
|
||||
background: var(--ts-surface);
|
||||
box-shadow: var(--ts-shadow);
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
}
|
||||
.ts-switch input:checked + .ts-switch__track {
|
||||
background: var(--ts-brand);
|
||||
&::after {
|
||||
transform: translateX(1.125rem);
|
||||
}
|
||||
}
|
||||
.ts-danger {
|
||||
border: 1px solid color-mix(in srgb, var(--ts-c-red) 45%, transparent);
|
||||
h3 {
|
||||
color: var(--ts-c-red);
|
||||
}
|
||||
}
|
||||
.ts-danger__confirm {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.ts-danger__label {
|
||||
display: grid;
|
||||
gap: 0.375rem;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--ts-ink-soft);
|
||||
code {
|
||||
font-family: var(--ts-font-mono);
|
||||
font-weight: 600;
|
||||
}
|
||||
.ts-input {
|
||||
width: 12rem;
|
||||
}
|
||||
}
|
||||
.ts-delete {
|
||||
min-width: 0 !important;
|
||||
height: 2.125rem;
|
||||
padding: 0 1rem !important;
|
||||
border: 0 !important;
|
||||
border-radius: 999px !important;
|
||||
background: var(--ts-c-red) !important;
|
||||
color: #fff !important;
|
||||
font: inherit;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
&:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
.ts-settings {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
padding-bottom: 5rem;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
fieldset {
|
||||
display: grid;
|
||||
@@ -745,6 +928,8 @@ export class SettingsPage {
|
||||
() => this.facade.project()?.settings ?? null,
|
||||
);
|
||||
protected readonly draft = signal<ProjectSettings | null>(null);
|
||||
/** The key, typed to confirm deleting the project. */
|
||||
protected readonly confirmKey = signal('');
|
||||
|
||||
protected readonly dirty = computed(
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user