Allow setting permission of collections during import (#6799)
* Allow setting permission of collections during import closes #6767 * Remove unused column
This commit is contained in:
@@ -160,7 +160,7 @@ router.post(
|
||||
transaction(),
|
||||
async (ctx: APIContext<T.CollectionsImportReq>) => {
|
||||
const { transaction } = ctx.state;
|
||||
const { attachmentId, format } = ctx.input.body;
|
||||
const { attachmentId, permission, format } = ctx.input.body;
|
||||
|
||||
const { user } = ctx.state.auth;
|
||||
authorize(user, "importCollection", user.team);
|
||||
@@ -179,6 +179,9 @@ router.post(
|
||||
key: attachment.key,
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
options: {
|
||||
permission,
|
||||
},
|
||||
},
|
||||
{
|
||||
transaction,
|
||||
|
||||
@@ -68,6 +68,10 @@ export type CollectionsDocumentsReq = z.infer<
|
||||
|
||||
export const CollectionsImportSchema = BaseSchema.extend({
|
||||
body: z.object({
|
||||
permission: z
|
||||
.nativeEnum(CollectionPermission)
|
||||
.nullish()
|
||||
.transform((val) => (isUndefined(val) ? null : val)),
|
||||
attachmentId: z.string().uuid(),
|
||||
format: z
|
||||
.nativeEnum(FileOperationFormat)
|
||||
|
||||
Reference in New Issue
Block a user