Sharkey/packages/backend/src/server/api/endpoints/sw/unregister.ts

24 lines
438 B
TypeScript
Raw Normal View History

import $ from 'cafy';
import define from '../../define';
import { SwSubscriptions } from '../../../../models';
export const meta = {
tags: ['account'],
requireCredential: true as const,
params: {
endpoint: {
2021-12-09 16:58:30 +02:00
validator: $.str,
},
2021-12-09 16:58:30 +02:00
},
};
2022-01-02 19:12:50 +02:00
// eslint-disable-next-line import/no-default-export
export default define(meta, async (ps, user) => {
await SwSubscriptions.delete({
userId: user.id,
endpoint: ps.endpoint,
});
});