fix: keep limit if using postgres
This commit is contained in:
parent
c41b845f66
commit
ed1599aaf7
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,7 @@ import { genId } from "@/misc/gen-id.js";
|
||||||
import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js";
|
import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js";
|
||||||
import { ApiError } from "../../error.js";
|
import { ApiError } from "../../error.js";
|
||||||
import { publishInternalEvent } from "@/services/stream.js";
|
import { publishInternalEvent } from "@/services/stream.js";
|
||||||
|
import { scyllaClient } from "@/db/scylla.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["antennas"],
|
tags: ["antennas"],
|
||||||
|
@ -112,7 +113,8 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const antennas = await Antennas.findBy({
|
const antennas = await Antennas.findBy({
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
});
|
});
|
||||||
if (antennas.length > 100 && !user.isAdmin) {
|
const antennaLimit = scyllaClient ? 100 : 5;
|
||||||
|
if (antennas.length > antennaLimit && !user.isAdmin) {
|
||||||
throw new ApiError(meta.errors.tooManyAntennas);
|
throw new ApiError(meta.errors.tooManyAntennas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue