• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 24849848918

23 Apr 2026 05:41PM UTC coverage: 32.29% (-39.0%) from 71.255%
24849848918

Pull #1046

github

web-flow
Merge a19e2e1fd into 82d3f6383
Pull Request #1046: refactor: drop axios from tests and webhooks

1530 of 5420 branches covered (28.23%)

Branch coverage included in aggregate %.

4 of 20 new or added lines in 1 file covered. (20.0%)

3875 existing lines in 165 files now uncovered.

3317 of 9591 relevant lines covered (34.58%)

10.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.33
/src/http/routes/object/moveObject.ts
1
import { FastifyInstance, FastifyRequest } from 'fastify'
2
import { FromSchema } from 'json-schema-to-ts'
3
import { createDefaultSchema } from '../../routes-helper'
4
import { AuthenticatedRequest } from '../../types'
5
import { ROUTE_OPERATIONS } from '../operations'
6

7
const moveObjectsBodySchema = {
2✔
8
  type: 'object',
9
  properties: {
10
    bucketId: { type: 'string', examples: ['avatars'] },
11
    sourceKey: { type: 'string', examples: ['folder/cat.png'] },
12
    destinationBucket: { type: 'string', examples: ['users'] },
13
    destinationKey: { type: 'string', examples: ['folder/newcat.png'] },
14
  },
15
  required: ['bucketId', 'sourceKey', 'destinationKey'],
16
} as const
17
const successResponseSchema = {
2✔
18
  type: 'object',
19
  properties: {
20
    message: { type: 'string', examples: ['Successfully moved'] },
21
  },
22
  required: ['message'],
23
}
24
interface moveObjectRequestInterface extends AuthenticatedRequest {
25
  Body: FromSchema<typeof moveObjectsBodySchema>
26
}
27

28
export default async function routes(fastify: FastifyInstance) {
UNCOV
29
  const summary = 'Moves an object'
×
30

UNCOV
31
  const schema = createDefaultSchema(successResponseSchema, {
×
32
    body: moveObjectsBodySchema,
33
    summary,
34
    tags: ['object'],
35
  })
36

UNCOV
37
  fastify.post<moveObjectRequestInterface>(
×
38
    '/move',
39
    {
40
      schema,
41
      config: {
42
        operation: { type: ROUTE_OPERATIONS.MOVE_OBJECT },
43
        resources: (req: FastifyRequest<moveObjectRequestInterface>) => {
UNCOV
44
          const { sourceKey, destinationKey, bucketId, destinationBucket } = req.body
×
UNCOV
45
          return [`${bucketId}/${sourceKey}`, `${destinationBucket || bucketId}/${destinationKey}`]
×
46
        },
47
      },
48
    },
49
    async (request, response) => {
UNCOV
50
      const { destinationKey, sourceKey, bucketId, destinationBucket } = request.body
×
51

UNCOV
52
      const destinationBucketId = destinationBucket || bucketId
×
53

UNCOV
54
      const move = await request.storage
×
55
        .from(bucketId)
56
        .moveObject(sourceKey, destinationBucketId, destinationKey, 'standard', request.owner)
57

UNCOV
58
      return response.status(200).send({
×
59
        message: 'Successfully moved',
60
        Id: move.destObject.id,
61
        Key: move.destObject.name,
62
      })
63
    }
64
  )
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc