Skip to content

Commit c926d1a

Browse files
committed
feat(teams): add team root query
1 parent e5da3f8 commit c926d1a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/api/schema.js

+1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const rootSchema = `
250250
inviteByHash(hash:String!): [Invite]
251251
contact(id:String!): CampaignContact
252252
assignment(id:String!): Assignment
253+
team(id: String!): Team!
253254
organizations: [Organization]
254255
availableActions(organizationId:String!): [Action]
255256
conversations(cursor:OffsetLimitCursor!, organizationId:String!, campaignsFilter:CampaignsFilter, assignmentsFilter:AssignmentsFilter, tagsFilter: TagsFilter, contactsFilter:ContactsFilter, contactNameFilter:ContactNameFilter): PaginatedConversations

src/server/api/schema.js

+9
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,15 @@ const rootResolvers = {
25822582
},
25832583
organization: async (_, { id }, { loaders }) =>
25842584
loaders.organization.load(id),
2585+
team: async (_, { id }, { user }) => {
2586+
authRequired(user);
2587+
const team = await r
2588+
.knex("team")
2589+
.where({ id })
2590+
.first();
2591+
await accessRequired(user, team.organization_id, "SUPERVOLUNTEER");
2592+
return team;
2593+
},
25852594
inviteByHash: async (_, { hash }, { loaders, user }) => {
25862595
authRequired(user);
25872596
return r.table("invite").filter({ hash });

0 commit comments

Comments
 (0)