egirlskey/packages/backend/src/core/entities/SigninEntityService.ts

33 lines
673 B
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Injectable } from '@nestjs/common';
import type { } from '@/models/Blocking.js';
import type { MiSignin } from '@/models/Signin.js';
import { bindThis } from '@/decorators.js';
import { IdService } from '@/core/IdService.js';
2022-09-17 18:27:08 +00:00
@Injectable()
export class SigninEntityService {
constructor(
private idService: IdService,
2022-09-17 18:27:08 +00:00
) {
}
@bindThis
2022-09-17 18:27:08 +00:00
public async pack(
src: MiSignin,
2022-09-17 18:27:08 +00:00
) {
return {
id: src.id,
createdAt: this.idService.parse(src.id).date.toISOString(),
ip: src.ip,
headers: src.headers,
success: src.success,
};
2022-09-17 18:27:08 +00:00
}
}