@gbl-uzh/platform 0.4.6 → 0.4.9
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 +26 -1
- 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 = {};
|
|
@@ -1719,6 +1735,9 @@ async function getPlayerResult(args, ctx) {
|
|
|
1719
1735
|
player: {
|
|
1720
1736
|
id: args.playerId
|
|
1721
1737
|
}
|
|
1738
|
+
},
|
|
1739
|
+
orderBy: {
|
|
1740
|
+
createdAt: "desc"
|
|
1722
1741
|
}
|
|
1723
1742
|
});
|
|
1724
1743
|
return {
|
|
@@ -1896,6 +1915,9 @@ async function getPlayerTransactions(args, ctx) {
|
|
|
1896
1915
|
player: {
|
|
1897
1916
|
id: ctx.user.sub
|
|
1898
1917
|
}
|
|
1918
|
+
},
|
|
1919
|
+
orderBy: {
|
|
1920
|
+
createdAt: "desc"
|
|
1899
1921
|
}
|
|
1900
1922
|
});
|
|
1901
1923
|
return playerActions;
|
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
|
});
|
|
@@ -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"));
|
|
@@ -1995,6 +2012,9 @@ async function getPlayerResult(args, ctx) {
|
|
|
1995
2012
|
player: {
|
|
1996
2013
|
id: args.playerId
|
|
1997
2014
|
}
|
|
2015
|
+
},
|
|
2016
|
+
orderBy: {
|
|
2017
|
+
createdAt: "desc"
|
|
1998
2018
|
}
|
|
1999
2019
|
});
|
|
2000
2020
|
return {
|
|
@@ -2246,6 +2266,11 @@ function generateBaseMutations({
|
|
|
2246
2266
|
return loginAsTeam(args, ctx);
|
|
2247
2267
|
}
|
|
2248
2268
|
});
|
|
2269
|
+
t.boolean("logoutAsTeam", {
|
|
2270
|
+
async resolve(_, __, ctx) {
|
|
2271
|
+
return logoutAsTeam(ctx);
|
|
2272
|
+
}
|
|
2273
|
+
});
|
|
2249
2274
|
t.field("createGame", {
|
|
2250
2275
|
type: Game,
|
|
2251
2276
|
args: {
|