Removed ad endpoints
ci/woodpecker/push/ociImageTag Pipeline is pending Details

This commit is contained in:
Natty 2024-01-01 20:32:32 +01:00
parent a1d8e1ac97
commit e046598329
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
5 changed files with 0 additions and 178 deletions

View File

@ -5,10 +5,6 @@ import * as ep___admin_abuseUserReports from "./endpoints/admin/abuse-user-repor
import * as ep___admin_accounts_create from "./endpoints/admin/accounts/create.js";
import * as ep___admin_accounts_delete from "./endpoints/admin/accounts/delete.js";
import * as ep___admin_accounts_hosted from "./endpoints/admin/accounts/hosted.js";
import * as ep___admin_ad_create from "./endpoints/admin/ad/create.js";
import * as ep___admin_ad_delete from "./endpoints/admin/ad/delete.js";
import * as ep___admin_ad_list from "./endpoints/admin/ad/list.js";
import * as ep___admin_ad_update from "./endpoints/admin/ad/update.js";
import * as ep___admin_announcements_create from "./endpoints/admin/announcements/create.js";
import * as ep___admin_announcements_delete from "./endpoints/admin/announcements/delete.js";
import * as ep___admin_announcements_list from "./endpoints/admin/announcements/list.js";
@ -331,10 +327,6 @@ const eps = [
["admin/accounts/create", ep___admin_accounts_create],
["admin/accounts/delete", ep___admin_accounts_delete],
["admin/accounts/hosted", ep___admin_accounts_hosted],
["admin/ad/create", ep___admin_ad_create],
["admin/ad/delete", ep___admin_ad_delete],
["admin/ad/list", ep___admin_ad_list],
["admin/ad/update", ep___admin_ad_update],
["admin/announcements/create", ep___admin_announcements_create],
["admin/announcements/delete", ep___admin_announcements_delete],
["admin/announcements/list", ep___admin_announcements_list],

View File

@ -1,46 +0,0 @@
import define from "../../../define.js";
import { Ads } from "@/models/index.js";
import { genId } from "@/misc/gen-id.js";
export const meta = {
tags: ["admin"],
requireCredential: true,
requireModerator: true,
} as const;
export const paramDef = {
type: "object",
properties: {
url: { type: "string", minLength: 1 },
memo: { type: "string" },
place: { type: "string" },
priority: { type: "string" },
ratio: { type: "integer" },
expiresAt: { type: "integer" },
imageUrl: { type: "string", minLength: 1 },
},
required: [
"url",
"memo",
"place",
"priority",
"ratio",
"expiresAt",
"imageUrl",
],
} as const;
export default define(meta, paramDef, async (ps) => {
await Ads.insert({
id: genId(),
createdAt: new Date(),
expiresAt: new Date(ps.expiresAt),
url: ps.url,
imageUrl: ps.imageUrl,
priority: ps.priority,
ratio: ps.ratio,
place: ps.place,
memo: ps.memo,
});
});

View File

@ -1,34 +0,0 @@
import define from "../../../define.js";
import { Ads } from "@/models/index.js";
import { ApiError } from "../../../error.js";
export const meta = {
tags: ["admin"],
requireCredential: true,
requireModerator: true,
errors: {
noSuchAd: {
message: "No such ad.",
code: "NO_SUCH_AD",
id: "ccac9863-3a03-416e-b899-8a64041118b1",
},
},
} as const;
export const paramDef = {
type: "object",
properties: {
id: { type: "string", format: "misskey:id" },
},
required: ["id"],
} as const;
export default define(meta, paramDef, async (ps, me) => {
const ad = await Ads.findOneBy({ id: ps.id });
if (ad == null) throw new ApiError(meta.errors.noSuchAd);
await Ads.delete(ad.id);
});

View File

@ -1,32 +0,0 @@
import define from "../../../define.js";
import { Ads } from "@/models/index.js";
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
export const meta = {
tags: ["admin"],
requireCredential: true,
requireModerator: true,
} as const;
export const paramDef = {
type: "object",
properties: {
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
sinceId: { type: "string", format: "misskey:id" },
untilId: { type: "string", format: "misskey:id" },
},
required: [],
} as const;
export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery(
Ads.createQueryBuilder("ad"),
ps.sinceId,
ps.untilId,
).andWhere("ad.expiresAt > :now", { now: new Date() });
const ads = await query.take(ps.limit).getMany();
return ads;
});

View File

@ -1,58 +0,0 @@
import define from "../../../define.js";
import { Ads } from "@/models/index.js";
import { ApiError } from "../../../error.js";
export const meta = {
tags: ["admin"],
requireCredential: true,
requireModerator: true,
errors: {
noSuchAd: {
message: "No such ad.",
code: "NO_SUCH_AD",
id: "b7aa1727-1354-47bc-a182-3a9c3973d300",
},
},
} as const;
export const paramDef = {
type: "object",
properties: {
id: { type: "string", format: "misskey:id" },
memo: { type: "string" },
url: { type: "string", minLength: 1 },
imageUrl: { type: "string", minLength: 1 },
place: { type: "string" },
priority: { type: "string" },
ratio: { type: "integer" },
expiresAt: { type: "integer" },
},
required: [
"id",
"memo",
"url",
"imageUrl",
"place",
"priority",
"ratio",
"expiresAt",
],
} as const;
export default define(meta, paramDef, async (ps, me) => {
const ad = await Ads.findOneBy({ id: ps.id });
if (ad == null) throw new ApiError(meta.errors.noSuchAd);
await Ads.update(ad.id, {
url: ps.url,
place: ps.place,
priority: ps.priority,
ratio: ps.ratio,
memo: ps.memo,
imageUrl: ps.imageUrl,
expiresAt: new Date(ps.expiresAt),
});
});