added functionality for user subscriptions

This commit is contained in:
Mikayla Dobson
2022-11-26 12:52:59 -06:00
parent 99c48d2a6e
commit 03ec2bf38c
18 changed files with 279 additions and 40 deletions

View File

@@ -21,4 +21,20 @@ export default class CollectionCtl {
if (!result) throw createError('400', 'Bad request');
return result;
}
async getSubscriptions(userid: string) {
const result = await CollectionInstance.getSubscriptions(userid);
if (!result) throw createError('404', 'No subscriptions found');
return result;
}
async postSubscription(collectionid: string, userid: string) {
const { ok, code, data } = await CollectionInstance.postSubscription(collectionid, userid);
if (ok) {
return data;
} else {
throw createError(code, data);
}
}
}