Merge branch 'develop' into feature/2024.10
This commit is contained in:
commit
1837ccc618
24 changed files with 1638 additions and 233 deletions
|
|
@ -15,6 +15,8 @@ import { SystemWebhookService } from '@/core/SystemWebhookService.js';
|
|||
import { UserSearchService } from '@/core/UserSearchService.js';
|
||||
import { WebhookTestService } from '@/core/WebhookTestService.js';
|
||||
import { FlashService } from '@/core/FlashService.js';
|
||||
import { TimeService } from '@/core/TimeService.js';
|
||||
import { EnvService } from '@/core/EnvService.js';
|
||||
import { AccountMoveService } from './AccountMoveService.js';
|
||||
import { AccountUpdateService } from './AccountUpdateService.js';
|
||||
import { AnnouncementService } from './AnnouncementService.js';
|
||||
|
|
@ -384,6 +386,8 @@ const $SponsorsService: Provider = { provide: 'SponsorsService', useExisting: Sp
|
|||
ChannelFollowingService,
|
||||
RegistryApiService,
|
||||
ReversiService,
|
||||
TimeService,
|
||||
EnvService,
|
||||
|
||||
ChartLoggerService,
|
||||
FederationChart,
|
||||
|
|
@ -685,6 +689,8 @@ const $SponsorsService: Provider = { provide: 'SponsorsService', useExisting: Sp
|
|||
ChannelFollowingService,
|
||||
RegistryApiService,
|
||||
ReversiService,
|
||||
TimeService,
|
||||
EnvService,
|
||||
|
||||
FederationChart,
|
||||
NotesChart,
|
||||
|
|
|
|||
20
packages/backend/src/core/EnvService.ts
Normal file
20
packages/backend/src/core/EnvService.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
/**
|
||||
* Provides access to the process environment variables.
|
||||
* This exists for testing purposes, so that a test can mock the environment without corrupting state for other tests.
|
||||
*/
|
||||
@Injectable()
|
||||
export class EnvService {
|
||||
/**
|
||||
* Passthrough to process.env
|
||||
*/
|
||||
public get env() {
|
||||
return process.env;
|
||||
}
|
||||
}
|
||||
27
packages/backend/src/core/TimeService.ts
Normal file
27
packages/backend/src/core/TimeService.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
/**
|
||||
* Provides abstractions to access the current time.
|
||||
* Exists for unit testing purposes, so that tests can "simulate" any given time for consistency.
|
||||
*/
|
||||
@Injectable()
|
||||
export class TimeService {
|
||||
/**
|
||||
* Returns Date.now()
|
||||
*/
|
||||
public get now() {
|
||||
return Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Date instance.
|
||||
*/
|
||||
public get date() {
|
||||
return new Date();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue