Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NestFactory } from '@nestjs/core';
import { ValidationPipe, VersioningType } from '@nestjs/common';
import {
ValidationPipe,
VersioningType,
Expand All @@ -23,6 +24,12 @@ async function bootstrap() {
const configService = app.get(ConfigService);
const port = configService.get<number>('port');

app.setGlobalPrefix('api');
app.enableVersioning({
type: VersioningType.URI,
defaultVersion: '1',
});
app.useGlobalFilters(new AllExceptionsFilter());
app.setGlobalPrefix('api');
app.enableVersioning({
type: VersioningType.URI,
Expand Down Expand Up @@ -56,6 +63,19 @@ async function bootstrap() {
}),
);

// Swagger setup
const swaggerConfig = new DocumentBuilder()
.setTitle('Nestera API')
.setDescription('API documentation for the Nestera platform (URI versioned, e.g., /v1/)')
.setVersion('1.0')
.addBearerAuth()
.build();
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup('api/docs', app, document);

await app.listen(port || 3001);
console.log(`Application is running on: http://localhost:${port}/api (with URI versioning, e.g., /v1/)`);
console.log(`Swagger docs available at: http://localhost:${port}/api/docs (shows versioned endpoints)`);
// ── Swagger / OpenAPI setup ───────────────────────────────────────────────
const rateLimitDescription = `
## Authentication
Expand Down
7 changes: 6 additions & 1 deletion backend/src/modules/governance/governance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ export class GovernanceService {
governanceTokenContractId,
user.publicKey,
);
const votingPower = (balance / 10_000_000).toLocaleString(undefined, {
minimumFractionDigits: 0,
maximumFractionDigits: 0,
});
return { votingPower: `${votingPower} NST` };

return Number(balance) / 10_000_000;
}
Expand Down Expand Up @@ -822,4 +827,4 @@ export class GovernanceService {

return this.readRequiredPositiveInteger(value, key);
}
}
}
Loading