refactor: fix types
This commit is contained in:
		| @@ -10,9 +10,9 @@ import { getIpHash } from '@/misc/get-ip-hash.js'; | ||||
| import type { ILocalUser } from '@/models/entities/User.js'; | ||||
| import { IdService } from '@/core/IdService.js'; | ||||
| import { TwoFactorAuthenticationService } from '@/core/TwoFactorAuthenticationService.js'; | ||||
| import { bindThis } from '@/decorators.js'; | ||||
| import { RateLimiterService } from './RateLimiterService.js'; | ||||
| import { SigninService } from './SigninService.js'; | ||||
| import { bindThis } from '@/decorators.js'; | ||||
| import type { FastifyRequest, FastifyReply } from 'fastify'; | ||||
|  | ||||
| @Injectable() | ||||
| @@ -131,7 +131,7 @@ export class SigninApiService { | ||||
| 				createdAt: new Date(), | ||||
| 				userId: user.id, | ||||
| 				ip: request.ip, | ||||
| 				headers: request.headers, | ||||
| 				headers: request.headers as any, | ||||
| 				success: false, | ||||
| 			}); | ||||
|  | ||||
|   | ||||
| @@ -33,7 +33,7 @@ export class SigninService { | ||||
| 				createdAt: new Date(), | ||||
| 				userId: user.id, | ||||
| 				ip: request.ip, | ||||
| 				headers: request.headers, | ||||
| 				headers: request.headers as any, | ||||
| 				success: true, | ||||
| 			}).then(x => this.signinsRepository.findOneByOrFail(x.identifiers[0])); | ||||
| 	 | ||||
|   | ||||
| @@ -162,7 +162,7 @@ export class SignupApiService { | ||||
| 					token: secret, | ||||
| 				}; | ||||
| 			} catch (err) { | ||||
| 				throw new FastifyReplyError(400, err); | ||||
| 				throw new FastifyReplyError(400, typeof err === 'string' ? err : (err as Error).toString()); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -195,7 +195,7 @@ export class SignupApiService { | ||||
|  | ||||
| 			return this.signinService.signin(request, reply, account as ILocalUser); | ||||
| 		} catch (err) { | ||||
| 			throw new FastifyReplyError(400, err); | ||||
| 			throw new FastifyReplyError(400, typeof err === 'string' ? err : (err as Error).toString()); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -27,7 +27,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { | ||||
| 			return { | ||||
| 				params: Object.entries(ep.params.properties ?? {}).map(([k, v]) => ({ | ||||
| 					name: k, | ||||
| 					type: v.type.charAt(0).toUpperCase() + v.type.slice(1), | ||||
| 					type: v.type ? v.type.charAt(0).toUpperCase() + v.type.slice(1) : 'string', | ||||
| 				})), | ||||
| 			}; | ||||
| 		}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo