Skip to content

Commit

Permalink
iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed Jan 25, 2024
1 parent bdfd51a commit 5d29745
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/src/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getIndexById = async (req, res, next) => {
const pkpSession = await getPKPSession(req.session, index);
if(pkpSession){
const roles = getRolesFromSession(pkpSession);
Object.assign(index, roles);
Object.assign(index, {roles});
}
}

Expand Down
19 changes: 18 additions & 1 deletion api/src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export class IndexService {

try {
let didPayload = "";

if (this.did) {
didPayload = `did(first:10, account: "${this.did.id}") {
didPayload = `did(first:10, account: "${this.did.parent}") {
edges {
node {
id
Expand Down Expand Up @@ -73,8 +74,24 @@ export class IndexService {


const index = data.node;

if(index.did && index.did.edges && index.did.edges.length > 0){
const did = {};
index.did.edges.forEach((edge) => {
if(edge.node.type === "owner"){
did.isOwnerVisible = edge.node.deletedAt === null;
}
if(edge.node.type === "starred"){
did.isStarred = edge.node.deletedAt === null;
}
});
index.did = did;
}

index.ownerDID = await getOwnerProfile(index.signerPublicKey);



return index;

} catch (error) {
Expand Down

0 comments on commit 5d29745

Please sign in to comment.