first commit

This commit is contained in:
2026-10-03 13:40:26 +02:00
parent 732a5b5a16
commit 566f415fa7
555 changed files with 62704 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
import { Args, ID, Resolver, Subscription } from '@nestjs/graphql';
import { User } from '@task-stream/api/identity/domain';
import { CurrentUser } from '@task-stream/api/identity/presenters';
import { ChangesService } from '@task-stream/api/tracker/application';
import {
ActivityGql,
CommentChangeGql,
IssueChangeGql,
ProjectChangeGql,
ReleaseChangeGql,
} from './types';
const asIs = { resolve: <T>(payload: T) => payload };
/**
* Realtime API (graphql-ws). Events are emitted after the read model is
* updated, so a client can refetch and always see the new state.
*/
@Resolver()
export class SubscriptionResolver {
constructor(private readonly changes: ChangesService) {}
@Subscription(() => IssueChangeGql, {
...asIs,
description:
'Tickets created/updated/moved in a project (board in realtime)',
})
issueChanged(
@CurrentUser() me: User,
@Args('projectId', { type: () => ID }) projectId: string,
) {
return this.changes.watchIssues(me.id, projectId);
}
@Subscription(() => CommentChangeGql, asIs)
commentChanged(
@CurrentUser() me: User,
@Args('issueId', { type: () => ID }) issueId: string,
) {
return this.changes.watchComments(me.id, issueId);
}
@Subscription(() => ActivityGql, {
...asIs,
description: 'Live activity feed',
})
activityAdded(
@CurrentUser() me: User,
@Args('projectId', { type: () => ID }) projectId: string,
) {
return this.changes.watchActivity(me.id, projectId);
}
@Subscription(() => ReleaseChangeGql, asIs)
releaseChanged(
@CurrentUser() me: User,
@Args('projectId', { type: () => ID }) projectId: string,
) {
return this.changes.watchReleases(me.id, projectId);
}
@Subscription(() => ProjectChangeGql, asIs)
projectChanged(
@CurrentUser() me: User,
@Args('projectId', { type: () => ID }) projectId: string,
) {
return this.changes.watchProject(me.id, projectId);
}
@Subscription(() => ProjectChangeGql, {
...asIs,
description: 'Projects I am added to / removed from',
})
myProjectsChanged(@CurrentUser() me: User) {
return this.changes.watchMyProjects(me.id);
}
}