Add moveLocation change description

This commit is contained in:
Pieter Vander Vennet 2021-10-14 01:16:38 +02:00
parent c4590555ee
commit 0a3eb966c1
4 changed files with 38 additions and 3 deletions

View file

@ -16,7 +16,7 @@ export interface ChangeDescription {
/**
* The type of the change
*/
changeType: "answer" | "create" | "split" | "delete" | string
changeType: "answer" | "create" | "split" | "delete" | "move" | string
/**
* THe motivation for the change, e.g. 'deleted because does not exist anymore'
*/

View file

@ -3,15 +3,40 @@ import OsmChangeAction from "./OsmChangeAction";
import {Changes} from "../Changes";
export default class ChangeLocationAction extends OsmChangeAction {
private readonly _id: number;
private readonly _newLonLat: [number, number];
private readonly _meta: { theme: string; reason: string };
constructor(id: string, newLonLat: [number, number], meta: {
theme: string,
reason: string
}) {
super();
if (!id.startsWith("node/")) {
throw "Invalid ID: only 'node/number' is accepted"
}
this._id = Number(id.substring("node/".length))
this._newLonLat = newLonLat;
this._meta = meta;
throw "TODO"
}
protected CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
return Promise.resolve([]);
protected async CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
const d: ChangeDescription = {
changes: {
lat: this._newLonLat[1],
lon: this._newLonLat[0]
},
type: "node",
id: this._id, meta: {
changeType: "move",
theme: this._meta.theme,
specialMotivation: this._meta.reason
}
}
return [d]
}
}

View file

@ -750,6 +750,11 @@
"override": {
"name": "Streets without etymology information"
}
},
"2": {
"override": {
"name": "Parks and forests without etymology information"
}
}
},
"shortDescription": "What is the origin of a toponym?",

View file

@ -631,6 +631,11 @@
"override": {
"name": "Straten zonder etymologische informatie"
}
},
"2": {
"override": {
"name": "Parken en bossen zonder etymologische informatie"
}
}
},
"shortDescription": "Wat is de oorsprong van een plaatsnaam?",