wip
This commit is contained in:
parent
931cea75b6
commit
3918473e29
|
@ -27,7 +27,8 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
export default class extends Endpoint<'admin/show-user'> {
|
||||
name = 'admin/show-user' as const;
|
||||
constructor(
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
@ -41,7 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
private roleService: RoleService,
|
||||
private roleEntityService: RoleEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
super(async (ps, me) => {
|
||||
const [user, profile] = await Promise.all([
|
||||
this.usersRepository.findOneBy({ id: ps.userId }),
|
||||
this.userProfilesRepository.findOneBy({ userId: ps.userId }),
|
||||
|
|
|
@ -1651,7 +1651,106 @@ export const endpoints = {
|
|||
}],
|
||||
},
|
||||
'admin/show-user': {
|
||||
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
|
||||
defines: [{
|
||||
req: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
userId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
required: ['userId'],
|
||||
},
|
||||
res: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
email: { type: ['string', 'null'] },
|
||||
emailVerified: { type: 'boolean' },
|
||||
autoAcceptFollowed: { type: 'boolean' },
|
||||
noCrawle: { type: 'boolean' },
|
||||
preventAiLearning: { type: 'boolean' },
|
||||
alwaysMarkNsfw: { type: 'boolean' },
|
||||
autoSensitive: { type: 'boolean' },
|
||||
carefulBot: { type: 'boolean' },
|
||||
injectFeaturedNote: { type: 'boolean' },
|
||||
receiveAnnouncementEmail: { type: 'boolean' },
|
||||
mutedWords: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
mutedInstances: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
mutingNotificationTypes: {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: 'https://misskey-hub.net/api/schemas/NotificationType',
|
||||
},
|
||||
},
|
||||
isModerator: { type: 'boolean' },
|
||||
isSilenced: { type: 'boolean' },
|
||||
isSuspended: { type: 'boolean' },
|
||||
lastActiveDate: {
|
||||
oneOf: [{
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
}, {
|
||||
type: 'null',
|
||||
}],
|
||||
},
|
||||
moderationNote: { type: 'string' },
|
||||
signins: {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: 'https://misskey-hub.net/api/schemas/SignIn',
|
||||
}
|
||||
},
|
||||
policies: {
|
||||
type: 'object',
|
||||
},
|
||||
roles: {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: 'https://misskey-hub.net/api/schemas/Role',
|
||||
}
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'email',
|
||||
'emailVerified',
|
||||
'autoAcceptFollowed',
|
||||
'noCrawle',
|
||||
'preventAiLearning',
|
||||
'alwaysMarkNsfw',
|
||||
'autoSensitive',
|
||||
'carefulBot',
|
||||
'injectFeaturedNote',
|
||||
'receiveAnnouncementEmail',
|
||||
'mutedWords',
|
||||
'mutedInstances',
|
||||
'mutingNotificationTypes',
|
||||
'isModerator',
|
||||
'isSilenced',
|
||||
'isSuspended',
|
||||
'lastActiveDate',
|
||||
'moderationNote',
|
||||
'signins',
|
||||
'policies',
|
||||
'roles',
|
||||
],
|
||||
}
|
||||
}],
|
||||
},
|
||||
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & {
|
|||
|
||||
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||
|
||||
export type ServerInfo = Selialized<Packed<'ServerInfo'>>;
|
||||
export type ServerInfo = Serialized<Packed<'ServerInfo'>>;
|
||||
|
||||
export type Stats = {
|
||||
notesCount: number;
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
packedUserSchema,
|
||||
} from './schemas/user.js';
|
||||
import {
|
||||
notificationTypeSchema,
|
||||
packedNotificationSchema,
|
||||
packedNotificationStrictSchema,
|
||||
} from './schemas/notification.js';
|
||||
|
@ -74,6 +75,7 @@ export const refs = {
|
|||
Note: packedNoteSchema,
|
||||
NoteReaction: packedNoteReactionSchema,
|
||||
NoteFavorite: packedNoteFavoriteSchema,
|
||||
NotificationType: notificationTypeSchema,
|
||||
Notification: packedNotificationSchema,
|
||||
NotificationStrict: packedNotificationStrictSchema,
|
||||
DriveFile: packedDriveFileSchema,
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import type { JSONSchema7Definition } from 'schema-type';
|
||||
import { ACHIEVEMENT_TYPES, notificationTypes } from '../consts';
|
||||
|
||||
export const notificationTypeSchema = {
|
||||
$id: 'https://misskey-hub.net/api/schemas/NotificationTypes',
|
||||
enum: [...notificationTypes],
|
||||
} as const satisfies JSONSchema7Definition;
|
||||
|
||||
export const packedNotificationSchema = {
|
||||
$id: 'https://misskey-hub.net/api/schemas/Notification',
|
||||
type: 'object',
|
||||
|
@ -10,10 +15,7 @@ export const packedNotificationSchema = {
|
|||
type: 'string',
|
||||
format: 'date-time',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
enum: [...notificationTypes],
|
||||
},
|
||||
type: { $ref: 'https://misskey-hub.net/api/schemas/NotificationType' },
|
||||
userId: {
|
||||
oneOf: [
|
||||
{ $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
|
|
Loading…
Reference in a new issue