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
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,27 @@ function createApp(dependencies = {}) {
const app = express();
const config = dependencies.config || loadConfig();
const database = dependencies.database || new AppDatabase(config.database.filename);

const auditLogService = dependencies.auditLogService || new CreatorAuditLogService(database);
const creatorActionService =
dependencies.creatorActionService || new CreatorActionService(database, auditLogService);
const creatorAuthService = dependencies.creatorAuthService || new CreatorAuthService(config);
const subscriptionVerifier =
dependencies.subscriptionVerifier || new SorobanSubscriptionVerifier(config);
const tokenService = dependencies.tokenService || new CdnTokenService(config);

// Notification and email utilities
const { NotificationService } = require('./src/services/notificationService');
const { sendEmail } = require('./src/utils/email');
const notificationService = dependencies.notificationService || new NotificationService(database);

const subscriptionService =
dependencies.subscriptionService || new SubscriptionService({
database,
auditLogService,
notificationService,
emailUtil: { sendEmail },
});
dependencies.subscriptionService || new SubscriptionService({ database, auditLogService, config });
const subscriptionExpiryChecker =
dependencies.subscriptionExpiryChecker ||
Expand Down Expand Up @@ -110,6 +123,8 @@ function createApp(dependencies = {}) {
app.use(express.json());
// Subscription events webhook
app.use('/api/subscription', require('./routes/subscription'));
// Payouts API
app.use('/api/payouts', require('./routes/payouts'));

// Global stats endpoints
app.use('/api/global-stats', createGlobalStatsRouter({ database, globalStatsService }));
Expand Down
Loading
Loading