1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.UserId = void 0;
|
4 | var type_graphql_1 = require("type-graphql");
|
5 | function 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 | }
|
17 | exports.UserId = UserId;
|
18 |
|
\ | No newline at end of file |