mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 14:33:08 +02:00
wip
This commit is contained in:
parent
931cea75b6
commit
3918473e29
5 changed files with 112 additions and 8 deletions
|
@ -27,7 +27,8 @@ export const paramDef = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
@Injectable()
|
@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(
|
constructor(
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
@ -41,7 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
private roleService: RoleService,
|
private roleService: RoleService,
|
||||||
private roleEntityService: RoleEntityService,
|
private roleEntityService: RoleEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(async (ps, me) => {
|
||||||
const [user, profile] = await Promise.all([
|
const [user, profile] = await Promise.all([
|
||||||
this.usersRepository.findOneBy({ id: ps.userId }),
|
this.usersRepository.findOneBy({ id: ps.userId }),
|
||||||
this.userProfilesRepository.findOneBy({ userId: ps.userId }),
|
this.userProfilesRepository.findOneBy({ userId: ps.userId }),
|
||||||
|
|
|
@ -1651,7 +1651,106 @@ export const endpoints = {
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
'admin/show-user': {
|
'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; };
|
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & {
|
||||||
|
|
||||||
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||||
|
|
||||||
export type ServerInfo = Selialized<Packed<'ServerInfo'>>;
|
export type ServerInfo = Serialized<Packed<'ServerInfo'>>;
|
||||||
|
|
||||||
export type Stats = {
|
export type Stats = {
|
||||||
notesCount: number;
|
notesCount: number;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
packedUserSchema,
|
packedUserSchema,
|
||||||
} from './schemas/user.js';
|
} from './schemas/user.js';
|
||||||
import {
|
import {
|
||||||
|
notificationTypeSchema,
|
||||||
packedNotificationSchema,
|
packedNotificationSchema,
|
||||||
packedNotificationStrictSchema,
|
packedNotificationStrictSchema,
|
||||||
} from './schemas/notification.js';
|
} from './schemas/notification.js';
|
||||||
|
@ -74,6 +75,7 @@ export const refs = {
|
||||||
Note: packedNoteSchema,
|
Note: packedNoteSchema,
|
||||||
NoteReaction: packedNoteReactionSchema,
|
NoteReaction: packedNoteReactionSchema,
|
||||||
NoteFavorite: packedNoteFavoriteSchema,
|
NoteFavorite: packedNoteFavoriteSchema,
|
||||||
|
NotificationType: notificationTypeSchema,
|
||||||
Notification: packedNotificationSchema,
|
Notification: packedNotificationSchema,
|
||||||
NotificationStrict: packedNotificationStrictSchema,
|
NotificationStrict: packedNotificationStrictSchema,
|
||||||
DriveFile: packedDriveFileSchema,
|
DriveFile: packedDriveFileSchema,
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import type { JSONSchema7Definition } from 'schema-type';
|
import type { JSONSchema7Definition } from 'schema-type';
|
||||||
import { ACHIEVEMENT_TYPES, notificationTypes } from '../consts';
|
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 = {
|
export const packedNotificationSchema = {
|
||||||
$id: 'https://misskey-hub.net/api/schemas/Notification',
|
$id: 'https://misskey-hub.net/api/schemas/Notification',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -10,10 +15,7 @@ export const packedNotificationSchema = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
format: 'date-time',
|
format: 'date-time',
|
||||||
},
|
},
|
||||||
type: {
|
type: { $ref: 'https://misskey-hub.net/api/schemas/NotificationType' },
|
||||||
type: 'string',
|
|
||||||
enum: [...notificationTypes],
|
|
||||||
},
|
|
||||||
userId: {
|
userId: {
|
||||||
oneOf: [
|
oneOf: [
|
||||||
{ $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
{ $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||||
|
|
Loading…
Reference in a new issue