chore: Upgrade Prettier 1.8 -> 2.0 (#1436)
This commit is contained in:
@ -17,7 +17,7 @@ import policy from "../policies";
|
||||
const { authorize } = policy;
|
||||
const router = new Router();
|
||||
|
||||
router.post("groups.list", auth(), pagination(), async ctx => {
|
||||
router.post("groups.list", auth(), pagination(), async (ctx) => {
|
||||
const { sort = "updatedAt" } = ctx.body;
|
||||
let direction = ctx.body.direction;
|
||||
if (direction !== "ASC") direction = "DESC";
|
||||
@ -34,7 +34,8 @@ router.post("groups.list", auth(), pagination(), async ctx => {
|
||||
|
||||
if (!user.isAdmin) {
|
||||
groups = groups.filter(
|
||||
group => group.groupMemberships.filter(gm => gm.userId === user.id).length
|
||||
(group) =>
|
||||
group.groupMemberships.filter((gm) => gm.userId === user.id).length
|
||||
);
|
||||
}
|
||||
|
||||
@ -43,9 +44,9 @@ router.post("groups.list", auth(), pagination(), async ctx => {
|
||||
data: {
|
||||
groups: groups.map(presentGroup),
|
||||
groupMemberships: groups
|
||||
.map(g =>
|
||||
.map((g) =>
|
||||
g.groupMemberships
|
||||
.filter(membership => !!membership.user)
|
||||
.filter((membership) => !!membership.user)
|
||||
.slice(0, MAX_AVATAR_DISPLAY)
|
||||
)
|
||||
.flat()
|
||||
@ -55,7 +56,7 @@ router.post("groups.list", auth(), pagination(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.info", auth(), async ctx => {
|
||||
router.post("groups.info", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -69,7 +70,7 @@ router.post("groups.info", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.create", auth(), async ctx => {
|
||||
router.post("groups.create", auth(), async (ctx) => {
|
||||
const { name } = ctx.body;
|
||||
ctx.assertPresent(name, "name is required");
|
||||
|
||||
@ -100,7 +101,7 @@ router.post("groups.create", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.update", auth(), async ctx => {
|
||||
router.post("groups.update", auth(), async (ctx) => {
|
||||
const { id, name } = ctx.body;
|
||||
ctx.assertPresent(name, "name is required");
|
||||
ctx.assertUuid(id, "id is required");
|
||||
@ -130,7 +131,7 @@ router.post("groups.update", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.delete", auth(), async ctx => {
|
||||
router.post("groups.delete", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -154,7 +155,7 @@ router.post("groups.delete", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.memberships", auth(), pagination(), async ctx => {
|
||||
router.post("groups.memberships", auth(), pagination(), async (ctx) => {
|
||||
const { id, query } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -190,12 +191,12 @@ router.post("groups.memberships", auth(), pagination(), async ctx => {
|
||||
pagination: ctx.state.pagination,
|
||||
data: {
|
||||
groupMemberships: memberships.map(presentGroupMembership),
|
||||
users: memberships.map(membership => presentUser(membership.user)),
|
||||
users: memberships.map((membership) => presentUser(membership.user)),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.add_user", auth(), async ctx => {
|
||||
router.post("groups.add_user", auth(), async (ctx) => {
|
||||
const { id, userId } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(userId, "userId is required");
|
||||
@ -249,7 +250,7 @@ router.post("groups.add_user", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("groups.remove_user", auth(), async ctx => {
|
||||
router.post("groups.remove_user", auth(), async (ctx) => {
|
||||
const { id, userId } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(userId, "userId is required");
|
||||
|
Reference in New Issue
Block a user