2021-08-21 07:47:18 +02:00
|
|
|
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-08-21 07:47:18 +02:00
|
|
|
},
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2021-08-21 07:47:18 +02:00
|
|
|
};
|
|
|
|
|
2022-01-02 18:12:50 +01:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2021-08-21 07:47:18 +02:00
|
|
|
export default define(meta, async (ps, user) => {
|
|
|
|
await SwSubscriptions.delete({
|
|
|
|
userId: user.id,
|
|
|
|
endpoint: ps.endpoint,
|
|
|
|
});
|
|
|
|
});
|