mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-11 23:02:56 +01:00
feat: Add Support for Parse Server v7 (#20)
* feat: Upgrade Aggregate queries to latest Parse API * feat: Save parse server major version in metadata This can be used to determine which version of the Parse API that will be used. * fix: Add support for both versions of aggregate queries
This commit is contained in:
committed by
Richard Osborne
parent
297022e19b
commit
f178d1c803
@@ -13,6 +13,7 @@ export default class SchemaHandler {
|
||||
public dbCollections: TSFixme[];
|
||||
public systemCollections: TSFixme[];
|
||||
public configSchema: TSFixme;
|
||||
public parseServerVersion: string;
|
||||
|
||||
constructor() {
|
||||
EventDispatcher.instance.on(
|
||||
@@ -119,6 +120,20 @@ export default class SchemaHandler {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
|
||||
// Get Parse Server Version & Supported features
|
||||
fetch(environment.url + '/serverInfo', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
"_method": "GET",
|
||||
"_ApplicationId": environment.appId,
|
||||
"_MasterKey": environment.masterKey,
|
||||
})
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
this.parseServerVersion = json.parseServerVersion;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -129,10 +144,20 @@ export default class SchemaHandler {
|
||||
ProjectModel.instance.setMetaData('dbCollections', this.dbCollections);
|
||||
ProjectModel.instance.setMetaData('systemCollections', this.systemCollections);
|
||||
ProjectModel.instance.setMetaData('dbConfigSchema', this.configSchema);
|
||||
|
||||
const versionNumbers = this.parseServerVersion?.split(".")
|
||||
if (versionNumbers && versionNumbers.length > 0) {
|
||||
// Let's only save the major version number,
|
||||
// since this will be used to determine which verison of the API to use.
|
||||
ProjectModel.instance.setMetaData('dbVersionMajor', versionNumbers[0]);
|
||||
} else {
|
||||
ProjectModel.instance.setMetaData('dbVersionMajor', undefined);
|
||||
}
|
||||
} else {
|
||||
ProjectModel.instance.setMetaData('dbCollections', undefined);
|
||||
ProjectModel.instance.setMetaData('systemCollections', undefined);
|
||||
ProjectModel.instance.setMetaData('dbConfigSchema', undefined);
|
||||
ProjectModel.instance.setMetaData('dbVersionMajor', undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user