import StatusPageSubscriberService from "../Services/StatusPageSubscriberService";
import Response from "../Utils/Response";
import BaseAPI from "./BaseAPI";
import StatusPageSubscriber from "../../Models/DatabaseModels/StatusPageSubscriber";
export default class StatusPageSubscriberAPI extends BaseAPI {
    constructor() {
        var _a;
        super(StatusPageSubscriber, StatusPageSubscriberService);
        this.router.get(`${(_a = new this.entityType().getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/unsubscribe/:id`, async (req, res, next) => {
            try {
                await this.service.updateOneBy({
                    query: {
                        _id: req.params["id"],
                    },
                    data: {
                        isUnsubscribed: true,
                    },
                    props: {
                        isRoot: true,
                        ignoreHooks: true,
                    },
                });
                return Response.sendHtmlResponse(req, res, "<html><body><p> You have been unsubscribed.</p><body><html>");
            }
            catch (err) {
                next(err);
            }
        });
    }
}
//# sourceMappingURL=StatusPageSubscriberAPI.js.map