Skip to content

Instantly share code, notes, and snippets.

@xperiandri
Last active February 13, 2022 21:57
Show Gist options
  • Save xperiandri/5e5963ac6ba514803623381b6a952937 to your computer and use it in GitHub Desktop.
Save xperiandri/5e5963ac6ba514803623381b6a952937 to your computer and use it in GitHub Desktop.
let GrupoMutationsType =
Define.Object<GrupoArgs>
(name = "GrupoMutations", description = "Group mutations",
fields =
[ Define.PatchesField("patch", PatchCacheKey,
// Attach policy / Цепляем политику
GrupoPatchMutations).WithAuthorizationPolicies<GrupoPatchViewModel> (Policies.GroupAdmin)
(Define.AsyncUnitResultField
("addAdmin", "Add group admin (any admin can do)",
[ Define.Input(Command, AddAdminCommandInputType) ],
// Attach policy / Цепляем политику
asyncAddGrupoAdmin)).WithAuthorizationPolicies<Unit> (Policies.GroupAdmin)
(Define.AsyncUnitResultField
("removeAdmin", "Remove group admin (only group owner can do)",
[ Define.Input(Command, RemoveAdminCommandInputType) ],
// Attach policy / Цепляем политику
asyncRemoveGrupoAdmin)).WithAuthorizationPolicies<Unit> (Policies.GroupOwner) ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment