Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore implementation #26

Merged
merged 51 commits into from
Sep 9, 2021
Merged

Firestore implementation #26

merged 51 commits into from
Sep 9, 2021

Conversation

MXPOL
Copy link
Collaborator

@MXPOL MXPOL commented Sep 1, 2021

No description provided.

// const filterParser = new FilterParser()
const dataProvider = new DataProvider(firestore)
const filterParser = new FilterParser()
const dataProvider = new DataProvider(firestore,filterParser)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space after ','

const filterOperations = this.filterParser.transform(filter)
const collectionRef = this.database.collection(collectionName)

filterOperations.forEach( filterOp => collectionRef.where(filterOp.fieldName,filterOp.opStr,filterOp.value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix to reduce

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and spaces after ',' (again)

async insert(collectionName, items) {
const batch = this.database.batch()

items.forEach( item => batch.set(this.database.doc(`${collectionName}/${item._id}`),item));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce

return (await batch.commit()).length
}

fixDates(value) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract those two function to another file, utils perhaps ?

}

items.forEach( item =>
batch.update(this.database.doc(`${collectionName}/${item._id}`),item));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after ','
shouldn't the forEach be a map or reduce here ?


async delete(collectionName, itemIds) {
const batch = this.database.batch()
itemIds.forEach( itemId => batch.delete(this.database.doc(`${collectionName}/${itemId}`)) )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to reduce

return EMPTY_FILTER;
}

// return {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed comments

return []
}

// switch (filter.operator) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens in case of $and/$or ?

return (await batch.commit()).length
}

asEntity(docEntity) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract

return value
}

const deleteQueryBatch = async (db, query, resolve) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code cannot be here, it should be on the main impl firestore_data_provider.js

Idokah and others added 11 commits September 9, 2021 14:04
* first version azure-adapter-installer

works now only for mysql, need to insert the enviorment variables (watch in init.js file)
need to change the login method, get params method (not process.env)

* add spinner

* fix test error azure

* nop
@MXPOL MXPOL merged commit 54bf6d6 into master Sep 9, 2021
@MXPOL MXPOL deleted the firestore-implementation branch September 9, 2021 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants