misskey/packages/backend/src/server/api/endpoints/email-address/available.ts
syuilo d071d18dd7
refactor: Use ESM (#8358)
* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
2022-02-27 11:07:39 +09:00

37 lines
756 B
TypeScript

import define from '../../define.js';
import { validateEmailForAccount } from '@/services/validate-email-for-account.js';
export const meta = {
tags: ['users'],
requireCredential: false,
res: {
type: 'object',
optional: false, nullable: false,
properties: {
available: {
type: 'boolean',
optional: false, nullable: false,
},
reason: {
type: 'string',
optional: false, nullable: true,
},
},
},
} as const;
export const paramDef = {
type: 'object',
properties: {
emailAddress: { type: 'string' },
},
required: ['emailAddress'],
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await validateEmailForAccount(ps.emailAddress);
});