summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/GetterService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-12-04 15:03:09 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-12-04 15:03:09 +0900
commitbbb49457f9fb5d46402e913c92ebf77722cad6ff (patch)
tree8ef285bcbab2c3a4a89d0a624a802d76a2864fed /packages/backend/src/server/api/GetterService.ts
parent:art: (diff)
downloadsharkey-bbb49457f9fb5d46402e913c92ebf77722cad6ff.tar.gz
sharkey-bbb49457f9fb5d46402e913c92ebf77722cad6ff.tar.bz2
sharkey-bbb49457f9fb5d46402e913c92ebf77722cad6ff.zip
refactor: introduce bindThis decorator to bind this automaticaly
Diffstat (limited to 'packages/backend/src/server/api/GetterService.ts')
-rw-r--r--packages/backend/src/server/api/GetterService.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/GetterService.ts b/packages/backend/src/server/api/GetterService.ts
index 70ab46ec35..c7f9916f97 100644
--- a/packages/backend/src/server/api/GetterService.ts
+++ b/packages/backend/src/server/api/GetterService.ts
@@ -5,6 +5,7 @@ import { IdentifiableError } from '@/misc/identifiable-error.js';
import type { User } from '@/models/entities/User.js';
import type { Note } from '@/models/entities/Note.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
+import { bindThis } from '@/decorators.js';
@Injectable()
export class GetterService {
@@ -22,6 +23,7 @@ export class GetterService {
/**
* Get note for API processing
*/
+ @bindThis
public async getNote(noteId: Note['id']) {
const note = await this.notesRepository.findOneBy({ id: noteId });
@@ -35,6 +37,7 @@ export class GetterService {
/**
* Get user for API processing
*/
+ @bindThis
public async getUser(userId: User['id']) {
const user = await this.usersRepository.findOneBy({ id: userId });
@@ -48,6 +51,7 @@ export class GetterService {
/**
* Get remote user for API processing
*/
+ @bindThis
public async getRemoteUser(userId: User['id']) {
const user = await this.getUser(userId);
@@ -61,6 +65,7 @@ export class GetterService {
/**
* Get local user for API processing
*/
+ @bindThis
public async getLocalUser(userId: User['id']) {
const user = await this.getUser(userId);