mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
bump version beta.1
This commit is contained in:
33 files changed
+1027
-1007
No files matched your search
@@ -216,8 +216,8 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
|
||||
: [Object.fromEntries(psdocs.map((i) => [i.rid, { _id: i.rid }])), []];
|
||||
if (!this.user.own(this.tdoc) && !this.user.hasPerm(PERM.PERM_EDIT_CONTEST)) {
|
||||
this.response.body.rdocs = this.response.body.rdocs.map((rdoc) => contest.applyProjection(this.tdoc, rdoc, this.user));
|
||||
for (const psdoc of psdocs) {
|
||||
this.response.body.rdict[psdoc.rid] = contest.applyProjection(this.tdoc, this.response.body.rdict[psdoc.rid], this.user);
|
||||
for (const key in this.response.body.rdict) {
|
||||
this.response.body.rdict[key] = contest.applyProjection(this.tdoc, this.response.body.rdict[key], this.user);
|
||||
}
|
||||
for (const key in this.response.body.psdict) {
|
||||
this.response.body.psdict[key] = contest.applyProjection(this.tdoc, this.response.body.psdict[key], this.user);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ObjectId } from 'mongodb';
|
||||
import { OplogDoc } from '../interface';
|
||||
import bus from '../service/bus';
|
||||
import db from '../service/db';
|
||||
import type { Handler } from '../service/server';
|
||||
import type { ConnectionHandler, Handler } from '../service/server';
|
||||
|
||||
export const coll = db.collection('oplog');
|
||||
|
||||
@@ -37,7 +37,7 @@ function safeKeys(data: any) {
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function log<T extends Handler>(handler: T, type: string, data: any) {
|
||||
export async function log<T extends Handler | ConnectionHandler>(handler: T, type: string, data: any) {
|
||||
const args = safeKeys(cloneDeep(handler.args));
|
||||
await bus.parallel('oplog/log', type, handler, args, data);
|
||||
const res = await coll.insertOne({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
BSON, Db, Filter, ObjectId, OnlyFieldsOfType,
|
||||
} from 'mongodb';
|
||||
import type { Handler } from '@hydrooj/framework';
|
||||
import type { ConnectionHandler, Handler } from '@hydrooj/framework';
|
||||
import pm2 from '@hydrooj/utils/lib/locate-pm2';
|
||||
import { Context } from '../context';
|
||||
import type {
|
||||
@@ -84,7 +84,7 @@ export interface EventMap {
|
||||
'contest/balloon': (domainId: string, tid: ObjectId, bdoc: ContestBalloonDoc) => VoidReturn
|
||||
'contest/del': (domainId: string, tid: ObjectId) => VoidReturn
|
||||
|
||||
'oplog/log': (type: string, handler: Handler<Context>, args: any, data: any) => VoidReturn;
|
||||
'oplog/log': (type: string, handler: Handler<Context> | ConnectionHandler<Context>, args: any, data: any) => VoidReturn;
|
||||
|
||||
'training/list': (query: Filter<TrainingDoc>, handler: any) => VoidReturn
|
||||
'training/get': (tdoc: TrainingDoc, handler: any) => VoidReturn
|
||||
|
||||
Reference in new issue
Block a user