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

23 lines
385 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
},
};
export default define(meta, async (ps, user) => {
await SwSubscriptions.delete({
userId: user.id,
endpoint: ps.endpoint,
});
});