Skip to content

Commit 90eaac8

Browse files
Merge pull request #475 from TogetherCrew/471-update-mediawiki-api
471 update mediawiki api
2 parents 7d749da + 9c6752e commit 90eaac8

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

src/docs/platform.doc.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,16 @@ paths:
165165
type: string
166166
description: Metadata for Notion.
167167
- type: object
168-
required: [baseURL, path]
168+
required: [baseURL, path, namespace]
169169
properties:
170170
baseURL:
171171
type: string
172172
path:
173173
type: string
174-
default: /w/api.php
174+
namespace:
175+
type: array
176+
items:
177+
type: number
175178
description: Metadata for MediaWiki.
176179
- type: object
177180
required: [id, period, analyzerStartedAt, resources]

src/validations/module.validation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ const hivemindNotionMetadata = () => {
7979

8080
const hivemindMediaWikiMetadata = () => {
8181
return Joi.object().keys({
82-
pageIds: Joi.array().items(Joi.string()),
8382
activated: Joi.boolean(),
8483
});
8584
};

src/validations/platform.validation.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ const websiteUpdateMetadata = () => {
3434
resources: Joi.array().items(Joi.string().uri({ scheme: ['http', 'https'] })),
3535
});
3636
};
37+
38+
const mediaWikiUpdateMetadata = () => {
39+
return Joi.object().keys({
40+
baseURL: Joi.string().required(),
41+
path: Joi.string().required(),
42+
namespace: Joi.array().items(Joi.number()).required(),
43+
});
44+
};
45+
3746
const twitterMetadata = () => {
3847
return Joi.object().keys({
3948
id: Joi.string().required(),
@@ -84,7 +93,8 @@ const notionMetadata = () => {
8493
const mediaWikiMetadata = () => {
8594
return Joi.object().keys({
8695
baseURL: Joi.string().required(),
87-
path: Joi.string().required().valid('/w/api.php'),
96+
path: Joi.string().required(),
97+
namespace: Joi.array().items(Joi.number()).required(),
8898
});
8999
};
90100

@@ -229,6 +239,16 @@ const dynamicUpdatePlatform = (req: Request) => {
229239
}),
230240
};
231241
}
242+
case PlatformNames.MediaWiki: {
243+
return {
244+
params: Joi.object().keys({
245+
platformId: Joi.required().custom(objectId),
246+
}),
247+
body: Joi.object().required().keys({
248+
metadata: mediaWikiUpdateMetadata(),
249+
}),
250+
};
251+
}
232252
default:
233253
req.allowInput = false;
234254
return {};

0 commit comments

Comments
 (0)