Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/docs/platform.doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@ paths:
type: string
description: Metadata for Notion.
- type: object
required: [baseURL, path]
required: [baseURL, path, namespace]
properties:
baseURL:
type: string
path:
type: string
default: /w/api.php
namespace:
type: array
items:
type: number
description: Metadata for MediaWiki.
- type: object
required: [id, period, analyzerStartedAt, resources]
Expand Down
1 change: 0 additions & 1 deletion src/validations/module.validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const hivemindNotionMetadata = () => {

const hivemindMediaWikiMetadata = () => {
return Joi.object().keys({
pageIds: Joi.array().items(Joi.string()),
activated: Joi.boolean(),
});
};
Expand Down
22 changes: 21 additions & 1 deletion src/validations/platform.validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ const websiteUpdateMetadata = () => {
resources: Joi.array().items(Joi.string().uri({ scheme: ['http', 'https'] })),
});
};

const mediaWikiUpdateMetadata = () => {
return Joi.object().keys({
baseURL: Joi.string().required(),
path: Joi.string().required(),
namespace: Joi.array().items(Joi.number()).required(),
});
};

const twitterMetadata = () => {
return Joi.object().keys({
id: Joi.string().required(),
Expand Down Expand Up @@ -84,7 +93,8 @@ const notionMetadata = () => {
const mediaWikiMetadata = () => {
return Joi.object().keys({
baseURL: Joi.string().required(),
path: Joi.string().required().valid('/w/api.php'),
path: Joi.string().required(),
namespace: Joi.array().items(Joi.number()).required(),
});
};

Expand Down Expand Up @@ -229,6 +239,16 @@ const dynamicUpdatePlatform = (req: Request) => {
}),
};
}
case PlatformNames.MediaWiki: {
return {
params: Joi.object().keys({
platformId: Joi.required().custom(objectId),
}),
body: Joi.object().required().keys({
metadata: mediaWikiUpdateMetadata(),
}),
};
}
default:
req.allowInput = false;
return {};
Expand Down