tests(api): Add sync method to api objects
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
/* eslint-disable no-use-before-define */
|
||||
|
||||
import { requester } from './requester';
|
||||
import { updateDocument as updateDocumentInMongo } from './mongo';
|
||||
import {
|
||||
getDocument as getDocumentFromMongo,
|
||||
updateDocument as updateDocumentInMongo,
|
||||
} from './mongo';
|
||||
import {
|
||||
assign,
|
||||
each,
|
||||
@@ -25,6 +28,14 @@ class ApiObject {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async sync () {
|
||||
let updatedDoc = await getDocumentFromMongo(this._docType, this);
|
||||
|
||||
assign(this, updatedDoc);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export class ApiUser extends ApiObject {
|
||||
|
||||
Reference in New Issue
Block a user