(ctx: Context, targetUserId: string)
| 217 | export const NOT_AUTHORIZED_MESSAGE = 'You are not authorized to do this'; |
| 218 | |
| 219 | export function assertIsUser(ctx: Context, targetUserId: string) { |
| 220 | if (isSuperUser(ctx)) return; |
| 221 | if (ctx.discordAccount?.id !== targetUserId) { |
| 222 | return new TRPCError({ |
| 223 | code: 'UNAUTHORIZED', |
| 224 | message: NOT_AUTHORIZED_MESSAGE, |
| 225 | }); |
| 226 | } |
| 227 | return; |
| 228 | } |
| 229 | export const INVALID_ROUTE_FOR_BOT_ERROR = |
| 230 | 'This route is unavailable to be called from the bot'; |
| 231 | export const INVALID_ROUTER_FOR_WEB_CLIENT_ERROR = |
no test coverage detected