Clone attachment to other piece

This commit is contained in:
2025-10-15 15:06:41 +02:00
parent 8c05c0e825
commit 589994d62f
7 changed files with 275 additions and 181 deletions

View File

@@ -169,12 +169,17 @@ export default Api.bundle({
// --- Attachment CRUD ---
createAttachment: Api.make(
Schema.Struct({
pieceId: PieceId,
filename: Schema.NonEmptyString,
mediaType: Schema.NonEmptyString,
data: Uint8ArrayArrayBufferFromSelf,
}),
pipe(
Schema.Union(
Schema.Struct({ data: Uint8ArrayArrayBufferFromSelf }),
Schema.Struct({ sha256: Sha256 }),
),
Schema.extend(Schema.Struct({
pieceId: PieceId,
filename: Schema.NonEmptyString,
mediaType: Schema.NonEmptyString,
})),
),
Attachment,
Schema.Union(Unauthenticated, Unauthorized, NotFound),
),