chore: Upgrade Prettier 1.8 -> 2.0 (#1436)
This commit is contained in:
@ -29,7 +29,7 @@ import policy from "../policies";
|
||||
const { authorize } = policy;
|
||||
const router = new Router();
|
||||
|
||||
router.post("collections.create", auth(), async ctx => {
|
||||
router.post("collections.create", auth(), async (ctx) => {
|
||||
const { name, color, description, icon, type } = ctx.body;
|
||||
const isPrivate = ctx.body.private;
|
||||
ctx.assertPresent(name, "name is required");
|
||||
@ -74,7 +74,7 @@ router.post("collections.create", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.info", auth(), async ctx => {
|
||||
router.post("collections.info", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -90,7 +90,7 @@ router.post("collections.info", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.add_group", auth(), async ctx => {
|
||||
router.post("collections.add_group", auth(), async (ctx) => {
|
||||
const { id, groupId, permission = "read_write" } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(groupId, "groupId is required");
|
||||
@ -140,7 +140,7 @@ router.post("collections.add_group", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.remove_group", auth(), async ctx => {
|
||||
router.post("collections.remove_group", auth(), async (ctx) => {
|
||||
const { id, groupId } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(groupId, "groupId is required");
|
||||
@ -173,7 +173,7 @@ router.post(
|
||||
"collections.group_memberships",
|
||||
auth(),
|
||||
pagination(),
|
||||
async ctx => {
|
||||
async (ctx) => {
|
||||
const { id, query, permission } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -226,13 +226,13 @@ router.post(
|
||||
collectionGroupMemberships: memberships.map(
|
||||
presentCollectionGroupMembership
|
||||
),
|
||||
groups: memberships.map(membership => presentGroup(membership.group)),
|
||||
groups: memberships.map((membership) => presentGroup(membership.group)),
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
router.post("collections.add_user", auth(), async ctx => {
|
||||
router.post("collections.add_user", auth(), async (ctx) => {
|
||||
const { id, userId, permission = "read_write" } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(userId, "userId is required");
|
||||
@ -282,7 +282,7 @@ router.post("collections.add_user", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.remove_user", auth(), async ctx => {
|
||||
router.post("collections.remove_user", auth(), async (ctx) => {
|
||||
const { id, userId } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
ctx.assertUuid(userId, "userId is required");
|
||||
@ -313,7 +313,7 @@ router.post("collections.remove_user", auth(), async ctx => {
|
||||
});
|
||||
|
||||
// DEPRECATED: Use collection.memberships which has pagination, filtering and permissions
|
||||
router.post("collections.users", auth(), async ctx => {
|
||||
router.post("collections.users", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -330,7 +330,7 @@ router.post("collections.users", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.memberships", auth(), pagination(), async ctx => {
|
||||
router.post("collections.memberships", auth(), pagination(), async (ctx) => {
|
||||
const { id, query, permission } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -380,12 +380,12 @@ router.post("collections.memberships", auth(), pagination(), async ctx => {
|
||||
pagination: ctx.state.pagination,
|
||||
data: {
|
||||
memberships: memberships.map(presentMembership),
|
||||
users: memberships.map(membership => presentUser(membership.user)),
|
||||
users: memberships.map((membership) => presentUser(membership.user)),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.export", auth(), async ctx => {
|
||||
router.post("collections.export", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
||||
@ -411,7 +411,7 @@ router.post("collections.export", auth(), async ctx => {
|
||||
ctx.body = fs.createReadStream(filePath);
|
||||
});
|
||||
|
||||
router.post("collections.export_all", auth(), async ctx => {
|
||||
router.post("collections.export_all", auth(), async (ctx) => {
|
||||
const { download = false } = ctx.body;
|
||||
|
||||
const user = ctx.state.user;
|
||||
@ -445,7 +445,7 @@ router.post("collections.export_all", auth(), async ctx => {
|
||||
}
|
||||
});
|
||||
|
||||
router.post("collections.update", auth(), async ctx => {
|
||||
router.post("collections.update", auth(), async (ctx) => {
|
||||
const { id, name, description, icon, color } = ctx.body;
|
||||
const isPrivate = ctx.body.private;
|
||||
ctx.assertPresent(name, "name is required");
|
||||
@ -508,7 +508,7 @@ router.post("collections.update", auth(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.list", auth(), pagination(), async ctx => {
|
||||
router.post("collections.list", auth(), pagination(), async (ctx) => {
|
||||
const user = ctx.state.user;
|
||||
const collectionIds = await user.collectionIds();
|
||||
let collections = await Collection.scope({
|
||||
@ -530,7 +530,7 @@ router.post("collections.list", auth(), pagination(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post("collections.delete", auth(), async ctx => {
|
||||
router.post("collections.delete", auth(), async (ctx) => {
|
||||
const { id } = ctx.body;
|
||||
const user = ctx.state.user;
|
||||
ctx.assertUuid(id, "id is required");
|
||||
|
Reference in New Issue
Block a user