Skip to content

Commit

Permalink
Made the filtering by context work for the all-did-master-posts a…
Browse files Browse the repository at this point in the history
…nd added he getReaction function
  • Loading branch information
baptistegreve committed Sep 21, 2022
1 parent 13cf720 commit e19c746
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,11 @@ export class Orbis {
query = this.api.rpc("all_master_posts").range(page * 50, (page + 1) * 50 - 1);
break;
case "all-did-master-posts":
query = this.api.rpc("all_did_master_posts", { post_did: options?.did }).range(page * 50, (page + 1) * 50 - 1);
if(options && options.context) {
query = this.api.rpc("all_did_master_posts_with_context", { post_did: options?.did, post_context: options.context }).range(page * 50, (page + 1) * 50 - 1);
} else {
query = this.api.rpc("all_did_master_posts", { post_did: options?.did }).range(page * 50, (page + 1) * 50 - 1);
}
break;
case "all-context-master-posts":
query = this.api.rpc("all_context_master_posts", { post_context: options?.context }).range(page * 50, (page + 1) * 50 - 1);
Expand Down Expand Up @@ -1082,6 +1086,14 @@ export class Orbis {
return({ data, error, status });
}

/** Get user reaction for a post */
async getReaction(post_id, did) {
let { data, error, status } = await this.api.from("orbis_reactions").select('type').eq('post_id', post_id).eq('creator', did);

/** Return results */
return({ data, error, status });
}

/** Get groups */
async getGroups() {
let { data, error, status } = await this.api.from("orbis_v_groups").select().order('last_activity_timestamp', { ascending: false });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbisclub/orbis-sdk",
"version": "0.3.43",
"version": "0.3.46",
"description": "Official package to implement quickly an Orbis powered decentralized social layer within your application.",
"author": "Baptiste Grève",
"license": "ISC",
Expand Down

0 comments on commit e19c746

Please sign in to comment.