mirror of
https://github.com/certd/certd.git
synced 2026-04-14 04:20:52 +08:00
19 lines
497 B
TypeScript
19 lines
497 B
TypeScript
import { IAccessService } from '@certd/pipeline';
|
|
|
|
export class AccessGetter implements IAccessService {
|
|
userId: number;
|
|
getter: <T>(id: any, userId?: number) => Promise<T>;
|
|
constructor(userId: number, getter: (id: any, userId: number) => Promise<any>) {
|
|
this.userId = userId;
|
|
this.getter = getter;
|
|
}
|
|
|
|
async getById<T = any>(id: any) {
|
|
return await this.getter<T>(id, this.userId);
|
|
}
|
|
|
|
async getCommonById<T = any>(id: any) {
|
|
return await this.getter<T>(id, 0);
|
|
}
|
|
}
|