A REST adapter next to GraphQL (presenters/http) that calls the same application services, so validation, permissions and domain errors are the same: projects (members, board, stats, activity), issues (search, workflow, assignee, release, links, comments, history), comments, releases and users. Projects and issues can be addressed by id or key (WEB, WEB-12). - Swagger UI at /api/docs, document at /api/docs-json and apps/api/openapi.json (rewritten by `nx serve api`, like schema.gql) for client generation. - Every route but health/auth/webhook needs a Pireon token: the document declares Pireon OAuth2 (authorization code + PKCE, password) through the /api/auth/token proxy, and a bearer scheme for apps with their own client. - configureApp() shares main.ts setup with the e2e, which now also covers REST. - SWAGGER_ENABLED / OPENAPI_FILE config; docs 03/05 and library READMEs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { DynamicModule, Module, Type } from '@nestjs/common';
|
|
import { APP_GUARD } from '@nestjs/core';
|
|
import { AuthGuard } from './auth/auth.guard';
|
|
import { WsAuthenticator } from './auth/ws-authenticator';
|
|
import { UserResolver } from './graphql/user.resolver';
|
|
import { AuthController } from './http/auth.controller';
|
|
import { PireonWebhookController } from './http/pireon-webhook.controller';
|
|
import { UsersController } from './http/users.controller';
|
|
|
|
/** Driving adapters of the identity context: global auth guard, REST (auth, users, webhook), GraphQL. */
|
|
@Module({
|
|
controllers: [AuthController, UsersController, PireonWebhookController],
|
|
providers: [
|
|
{ provide: APP_GUARD, useClass: AuthGuard },
|
|
WsAuthenticator,
|
|
UserResolver,
|
|
],
|
|
exports: [WsAuthenticator],
|
|
})
|
|
export class IdentityPresentersModule {
|
|
static withApplication(
|
|
applicationModule: Type | DynamicModule,
|
|
): DynamicModule {
|
|
return {
|
|
module: IdentityPresentersModule,
|
|
imports: [applicationModule],
|
|
exports: [WsAuthenticator],
|
|
};
|
|
}
|
|
}
|