File tree Expand file tree Collapse file tree 4 files changed +83
-2
lines changed
src/routes/api/admin/guilds/[guild]/tickets Expand file tree Collapse file tree 4 files changed +83
-2
lines changed Original file line number Diff line number Diff line change 1+ ## [ 4.0.48] ( https://github.com/discord-tickets/bot/compare/v4.0.47...v4.0.48 ) (2025-10-23)
2+
3+
4+ ### Features
5+
6+ * add sentry logging option ([ #654 ] ( https://github.com/discord-tickets/bot/issues/654 ) ) ([ 9980c28] ( https://github.com/discord-tickets/bot/commit/9980c28155ded450297e190cf6b994fc3bc1f7dc ) )
7+ * ** api:** list and get ticket routes ([ 94e9939] ( https://github.com/discord-tickets/bot/commit/94e993917aad5c20a698e7b51a606b6fc3cec841 ) )
8+ * ** i18n:** update English (United States) translations ([ 6d2c76f] ( https://github.com/discord-tickets/bot/commit/6d2c76f0e2fed36bbf67f1160ea63a0e207a905e ) )
9+ * ** i18n:** update English (United States) translations ([ 311de19] ( https://github.com/discord-tickets/bot/commit/311de19916dc186322ac3d614a3a3808b2572bb1 ) )
10+ * ** i18n:** update English (United States) translations ([ 9ccd9fa] ( https://github.com/discord-tickets/bot/commit/9ccd9fa248ec3d531485a361e791520ecbe1a5e4 ) )
11+ * ** i18n:** update French translations ([ 8c19094] ( https://github.com/discord-tickets/bot/commit/8c19094632bd45bd8263c26334d961d2b2e6013d ) )
12+ * ** i18n:** update French translations ([ fc502bf] ( https://github.com/discord-tickets/bot/commit/fc502bf65b510d7aff63f85654da56fa094123a1 ) )
13+ * ** i18n:** update French translations ([ b2d6ac7] ( https://github.com/discord-tickets/bot/commit/b2d6ac7cc3671858be0d0762d9e67d859c6f5bc3 ) )
14+ * ** i18n:** update French translations ([ 6439f7b] ( https://github.com/discord-tickets/bot/commit/6439f7b742bf9f4e17a157d19884270f6415fe13 ) )
15+ * ** i18n:** update French translations ([ 02605b2] ( https://github.com/discord-tickets/bot/commit/02605b26b51033c5eb11119f1bf1e1fa7f7fbf36 ) )
16+ * ** i18n:** update French translations ([ fdb9c29] ( https://github.com/discord-tickets/bot/commit/fdb9c2901792e530b378ab4afe49e6d53372061d ) )
17+ * ** i18n:** update Japanese translations ([ 23ccd9c] ( https://github.com/discord-tickets/bot/commit/23ccd9cdf28b8aeca0406c1b3b8757c0c0ebc637 ) )
18+ * ** i18n:** update Russian translations ([ 6facf1b] ( https://github.com/discord-tickets/bot/commit/6facf1b16b5d9c60499f7932915e2b8e9c4287b7 ) )
19+ * ** i18n:** update Russian translations ([ 82b44ab] ( https://github.com/discord-tickets/bot/commit/82b44aba26060a73cb2c3501968dfaff003b9171 ) )
20+ * ** i18n:** update Ukrainian translations ([ df4ae92] ( https://github.com/discord-tickets/bot/commit/df4ae92fce0b77c32767492e4d5caff9a0f7d4fa ) )
21+
22+
23+
124## [ 4.0.47] ( https://github.com/discord-tickets/bot/compare/v4.0.46...v4.0.47 ) (2025-07-27)
225
326
Original file line number Diff line number Diff line change 11{
22 "name" : " discord-tickets" ,
3- "version" : " 4.0.47 " ,
3+ "version" : " 4.0.48 " ,
44 "private" : " true" ,
55 "description" : " The most popular open-source ticket management bot for Discord." ,
66 "main" : " src/" ,
106106 "utf-8-validate" : " ^5.0.10" ,
107107 "zlib-sync" : " ^0.1.9"
108108 }
109- }
109+ }
Original file line number Diff line number Diff line change 1+ const { pools } = require ( '../../../../../../lib/threads' ) ;
2+ const { export : pool } = pools ;
3+
4+ module . exports . get = fastify => ( {
5+ handler : async ( req , res ) => {
6+ /** @type {import('client') } */
7+ const client = req . routeOptions . config . client ;
8+ const guildId = req . params . guild ;
9+ const ticketId = req . params . ticket ;
10+ const ticket = await client . prisma . ticket . findUnique ( {
11+ include : {
12+ archivedChannels : true ,
13+ archivedMessages : true ,
14+ archivedRoles : true ,
15+ archivedUsers : true ,
16+ feedback : true ,
17+ questionAnswers : true ,
18+ } ,
19+ where : {
20+ guildId, // ! prevent unauthorised access
21+ id : ticketId ,
22+ } ,
23+ } ) ;
24+
25+ if ( ! ticket ) return res . status ( 404 ) . send ( new Error ( 'Not Found' ) ) ;
26+
27+ res . header ( 'Content-Type' , 'application/json' ) ; // exportTicket returns stringified JSON
28+ return await pool . queue ( w => w . exportTicket ( ticket ) ) ;
29+ } ,
30+ onRequest : [ fastify . authenticate , fastify . isAdmin ] ,
31+ } ) ;
Original file line number Diff line number Diff line change 1+ const { pools } = require ( '../../../../../../lib/threads' ) ;
2+ const { crypto } = pools ;
3+
4+ module . exports . get = fastify => ( {
5+ handler : async req => {
6+ /** @type {import('client') } */
7+ const client = req . routeOptions . config . client ;
8+ const { query } = req ;
9+ // TODO: advanced filters
10+ const tickets = await client . prisma . ticket . findMany ( {
11+ orderBy : { createdAt : 'asc' } ,
12+ where : {
13+ createdAt : { gte : query . since && new Date ( ( Number ( query . since ) * 1000 ) || query . since ) } ,
14+ guildId : req . params . guild ,
15+ } ,
16+ } ) ;
17+ return Promise . all (
18+ tickets . map ( async ticket => {
19+ ticket . closedReason &&= await crypto . queue ( w => w . decrypt ( ticket . closedReason ) ) ;
20+ ticket . topic &&= await crypto . queue ( w => w . decrypt ( ticket . topic ) ) ;
21+ return ticket ;
22+ } ) ,
23+ ) ;
24+ } ,
25+ onRequest : [ fastify . authenticate , fastify . isAdmin ] ,
26+ } ) ;
27+
You can’t perform that action at this time.
0 commit comments