hippofish/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 15:58:30 +01:00
validator: $.str,
},
2021-12-09 15:58:30 +01:00
},
};
export default define(meta, async (ps, user) => {
await SwSubscriptions.delete({
userId: user.id,
endpoint: ps.endpoint,
});
});