hippofish/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 15:58:30 +01:00
validator: $.str,
},
2021-12-09 15:58:30 +01:00
},
};
2022-01-02 18:12:50 +01: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,
});
});