@gbl-uzh/platform 0.4.5 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -1
- package/dist/nexus.js +31 -3
- package/dist/ops/FSegmentData.graphql +2 -0
- package/dist/ops/MLogoutAsTeam.graphql +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -142,13 +142,16 @@ declare function loginAsTeam({ token }: LoginAsTeamArgs, ctx: CtxWithPrisma<Pris
|
|
|
142
142
|
createdAt: Date;
|
|
143
143
|
updatedAt: Date;
|
|
144
144
|
}, unknown> & {}) | null>;
|
|
145
|
+
declare function logoutAsTeam(ctx: CtxWithPrisma<PrismaClient>): Promise<boolean>;
|
|
145
146
|
|
|
146
147
|
declare const AccountService_createLoginToken: typeof createLoginToken;
|
|
147
148
|
declare const AccountService_loginAsTeam: typeof loginAsTeam;
|
|
149
|
+
declare const AccountService_logoutAsTeam: typeof logoutAsTeam;
|
|
148
150
|
declare namespace AccountService {
|
|
149
151
|
export {
|
|
150
152
|
AccountService_createLoginToken as createLoginToken,
|
|
151
153
|
AccountService_loginAsTeam as loginAsTeam,
|
|
154
|
+
AccountService_logoutAsTeam as logoutAsTeam,
|
|
152
155
|
};
|
|
153
156
|
}
|
|
154
157
|
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,8 @@ var logger_default = logger;
|
|
|
59
59
|
var AccountService_exports = {};
|
|
60
60
|
__export(AccountService_exports, {
|
|
61
61
|
createLoginToken: () => createLoginToken,
|
|
62
|
-
loginAsTeam: () => loginAsTeam
|
|
62
|
+
loginAsTeam: () => loginAsTeam,
|
|
63
|
+
logoutAsTeam: () => logoutAsTeam
|
|
63
64
|
});
|
|
64
65
|
var import_jsonwebtoken = __toESM(require("jsonwebtoken"));
|
|
65
66
|
var import_node_assert = require("assert");
|
|
@@ -136,6 +137,21 @@ async function loginAsTeam({ token }, ctx) {
|
|
|
136
137
|
}
|
|
137
138
|
return matchingPlayer;
|
|
138
139
|
}
|
|
140
|
+
async function logoutAsTeam(ctx) {
|
|
141
|
+
if (!ctx.user?.sub)
|
|
142
|
+
return false;
|
|
143
|
+
const matchingPlayer = await ctx.prisma.player.findUnique({
|
|
144
|
+
where: {
|
|
145
|
+
id: ctx.user.sub
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (matchingPlayer) {
|
|
149
|
+
const cookieName = process.env.NODE_ENV === "production" ? "__Secure-next-auth.session-token" : "next-auth.session-token";
|
|
150
|
+
(0, import_nookies.destroyCookie)(ctx, cookieName);
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
139
155
|
|
|
140
156
|
// src/services/EventService.ts
|
|
141
157
|
var EventService_exports = {};
|
|
@@ -1811,6 +1827,9 @@ async function attemptLearningElement(args, ctx) {
|
|
|
1811
1827
|
connect: {
|
|
1812
1828
|
id: args.elementId
|
|
1813
1829
|
}
|
|
1830
|
+
},
|
|
1831
|
+
completedLearningElementIds: {
|
|
1832
|
+
push: args.elementId
|
|
1814
1833
|
}
|
|
1815
1834
|
},
|
|
1816
1835
|
include: {
|
|
@@ -1880,6 +1899,9 @@ async function markStoryElement(args, ctx) {
|
|
|
1880
1899
|
connect: {
|
|
1881
1900
|
id: args.elementId
|
|
1882
1901
|
}
|
|
1902
|
+
},
|
|
1903
|
+
visitedStoryElementIds: {
|
|
1904
|
+
push: args.elementId
|
|
1883
1905
|
}
|
|
1884
1906
|
}
|
|
1885
1907
|
});
|
package/dist/nexus.js
CHANGED
|
@@ -122,7 +122,9 @@ var StoryElement = (0, import_nexus2.objectType)({
|
|
|
122
122
|
});
|
|
123
123
|
t.nonNull.string("title");
|
|
124
124
|
t.string("content");
|
|
125
|
-
t.
|
|
125
|
+
t.field("contentRole", {
|
|
126
|
+
type: "JSONObject"
|
|
127
|
+
});
|
|
126
128
|
t.field("reward", {
|
|
127
129
|
type: "JSONObject"
|
|
128
130
|
});
|
|
@@ -193,11 +195,11 @@ var Player = (0, import_nexus3.objectType)({
|
|
|
193
195
|
t.nonNull.list.nonNull.field("completedLearningElements", {
|
|
194
196
|
type: LearningElement
|
|
195
197
|
});
|
|
196
|
-
t.nonNull.list.nonNull.
|
|
198
|
+
t.nonNull.list.nonNull.string("completedLearningElementIds");
|
|
197
199
|
t.nonNull.list.nonNull.field("visitedStoryElements", {
|
|
198
200
|
type: StoryElement
|
|
199
201
|
});
|
|
200
|
-
t.nonNull.list.nonNull.
|
|
202
|
+
t.nonNull.list.nonNull.string("visitedStoryElementIds");
|
|
201
203
|
}
|
|
202
204
|
});
|
|
203
205
|
var PlayerResult = (0, import_nexus3.objectType)({
|
|
@@ -438,6 +440,21 @@ async function loginAsTeam({ token }, ctx) {
|
|
|
438
440
|
}
|
|
439
441
|
return matchingPlayer;
|
|
440
442
|
}
|
|
443
|
+
async function logoutAsTeam(ctx) {
|
|
444
|
+
if (!ctx.user?.sub)
|
|
445
|
+
return false;
|
|
446
|
+
const matchingPlayer = await ctx.prisma.player.findUnique({
|
|
447
|
+
where: {
|
|
448
|
+
id: ctx.user.sub
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
if (matchingPlayer) {
|
|
452
|
+
const cookieName = process.env.NODE_ENV === "production" ? "__Secure-next-auth.session-token" : "next-auth.session-token";
|
|
453
|
+
(0, import_nookies.destroyCookie)(ctx, cookieName);
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
441
458
|
|
|
442
459
|
// src/services/GameService.ts
|
|
443
460
|
var DB6 = __toESM(require("@prisma/client"));
|
|
@@ -2087,6 +2104,9 @@ async function attemptLearningElement(args, ctx) {
|
|
|
2087
2104
|
connect: {
|
|
2088
2105
|
id: args.elementId
|
|
2089
2106
|
}
|
|
2107
|
+
},
|
|
2108
|
+
completedLearningElementIds: {
|
|
2109
|
+
push: args.elementId
|
|
2090
2110
|
}
|
|
2091
2111
|
},
|
|
2092
2112
|
include: {
|
|
@@ -2156,6 +2176,9 @@ async function markStoryElement(args, ctx) {
|
|
|
2156
2176
|
connect: {
|
|
2157
2177
|
id: args.elementId
|
|
2158
2178
|
}
|
|
2179
|
+
},
|
|
2180
|
+
visitedStoryElementIds: {
|
|
2181
|
+
push: args.elementId
|
|
2159
2182
|
}
|
|
2160
2183
|
}
|
|
2161
2184
|
});
|
|
@@ -2240,6 +2263,11 @@ function generateBaseMutations({
|
|
|
2240
2263
|
return loginAsTeam(args, ctx);
|
|
2241
2264
|
}
|
|
2242
2265
|
});
|
|
2266
|
+
t.boolean("logoutAsTeam", {
|
|
2267
|
+
async resolve(_, __, ctx) {
|
|
2268
|
+
return logoutAsTeam(ctx);
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2243
2271
|
t.field("createGame", {
|
|
2244
2272
|
type: Game,
|
|
2245
2273
|
args: {
|