This commit is contained in:
syuilo
2018-03-29 15:23:15 +09:00
parent 1968d18e3f
commit 31006fbc25
10 changed files with 65 additions and 24 deletions

View File

@ -43,8 +43,9 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
// Get 'geo' parameter
const [geo, geoErr] = $(params.geo).optional.nullable.strict.object()
.have('latitude', $().number().range(-90, 90))
.have('longitude', $().number().range(-180, 180))
.have('coordinates', $().array().length(2)
.item(0, $().number().range(-180, 180))
.item(1, $().number().range(-90, 90)))
.have('altitude', $().nullable.number())
.have('accuracy', $().nullable.number())
.have('altitudeAccuracy', $().nullable.number())

View File

@ -35,8 +35,7 @@ export type IPost = {
reactionCounts: any;
mentions: mongo.ObjectID[];
geo: {
latitude: number;
longitude: number;
coordinates: number[];
altitude: number;
accuracy: number;
altitudeAccuracy: number;
@ -97,6 +96,7 @@ export const pack = async (
delete _post._id;
delete _post.mentions;
if (_post.geo) delete _post.geo.type;
// Parse text
if (_post.text) {