Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 4x 4x 69x 69x 69x 69x 69x 9x 9x | import type {RouteDeps, Router, RouterBase} from '../../types';
import type {BlockId} from '../schema';
export const del =
({t, services}: RouteDeps) =>
<R extends RouterBase>(r: Router<R>) => {
const Request = t.Object(
t.Key('id', t.Ref<typeof BlockId>('BlockId')).options({
title: 'Block ID',
description: 'The ID of the block to delete.',
}),
);
const Response = t.Object(
t.Key('success', t.bool).options({
title: 'Success',
description:
'Indicates whether the block was deleted successfully. Returns `false` if the block does not exist.',
}),
);
const Func = t.Function(Request, Response).options({
title: 'Delete Block',
intro: 'Deletes a block by ID.',
description: 'Deletes a block by ID. It will not rise an error if the block does not exist.',
});
return r.add('block.del', Func, async ({id}) => {
const success = await services.blocks.remove(id);
return {
success,
};
});
};
|