UNPKG

591 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.UserId = void 0;
4var type_graphql_1 = require("type-graphql");
5function UserId() {
6 return type_graphql_1.createParamDecorator(function (_a) {
7 var context = _a.context;
8 if (!context.user) {
9 throw new Error('`user` attribute not found on context');
10 }
11 if (!context.user.id) {
12 throw new Error('`user` attribute does not contain an `id`');
13 }
14 return context.user.id;
15 });
16}
17exports.UserId = UserId;
18//# sourceMappingURL=UserId.js.map
\No newline at end of file