fix: keep limit if using postgres

This commit is contained in:
Namekuji 2023-09-05 20:32:12 -04:00
parent c41b845f66
commit ed1599aaf7
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532

View file

@ -3,6 +3,7 @@ import { genId } from "@/misc/gen-id.js";
import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js";
import { ApiError } from "../../error.js";
import { publishInternalEvent } from "@/services/stream.js";
import { scyllaClient } from "@/db/scylla.js";
export const meta = {
tags: ["antennas"],
@ -112,7 +113,8 @@ export default define(meta, paramDef, async (ps, user) => {
const antennas = await Antennas.findBy({
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);
}