@bantr-sports/sdk 12.11.0 → 13.0.0
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/api-type/src/modules/chat/chat.repository.d.ts +26 -0
- package/api-type/src/modules/chat/chat.schema.d.ts +1 -0
- package/api-type/src/modules/chat/chat.service.d.ts +19 -0
- package/api-type/src/modules/free_agent_payments/free_agent_payments.schema.d.ts +11 -7
- package/api-type/src/modules/free_agent_payments/free_agent_payments.service.d.ts +1 -1
- package/api-type/src/modules/join_request/join_request.factory.d.ts +4 -0
- package/api-type/src/modules/join_request/join_request.schema.d.ts +53 -0
- package/api-type/src/modules/join_request/join_request.service.d.ts +105 -0
- package/api-type/src/modules/league_invite/league_invite.factory.d.ts +4 -0
- package/api-type/src/modules/league_invite/league_invite.schema.d.ts +30 -0
- package/api-type/src/modules/league_invite/league_invite.service.d.ts +29 -0
- package/api-type/src/modules/league_payments/league_payments.schema.d.ts +3 -0
- package/api-type/src/modules/league_payments/league_payments.service.d.ts +1 -1
- package/api-type/src/modules/marketplace/marketplace.schema.d.ts +6 -0
- package/api-type/src/modules/pickup_group_invite/pickup_group_invite.factory.d.ts +4 -0
- package/api-type/src/modules/pickup_group_invite/pickup_group_invite.schema.d.ts +41 -0
- package/api-type/src/modules/pickup_group_invite/pickup_group_invite.service.d.ts +17 -0
- package/api-type/src/modules/scout_feed/handlers/scout_feed.handler.d.ts +29 -0
- package/api-type/src/modules/scout_feed/handlers/scout_feed_base.handler.d.ts +236 -0
- package/api-type/src/modules/scout_feed/handlers/scout_feed_sport.config.d.ts +11 -0
- package/api-type/src/modules/scout_feed/scout_feed.constants.d.ts +8 -0
- package/api-type/src/modules/scout_feed/scout_feed.schema.d.ts +3984 -384
- package/api-type/src/modules/scout_feed/scout_feed.service.d.ts +10 -145
- package/api-type/src/modules/scout_feed/scout_feed.shared.d.ts +18 -0
- package/api-type/src/modules/scout_feed/scout_feed_location.d.ts +8 -5
- package/api-type/src/modules/scout_feed/scout_feed_stats.d.ts +6 -0
- package/api-type/src/modules/scout_feed/soccer_scorer/soccer.scorer.d.ts +5 -2
- package/api-type/src/modules/scout_profile/handlers/scout_profile_crud.handler.d.ts +73 -0
- package/api-type/src/modules/scout_profile/handlers/scout_profile_handler.d.ts +18 -0
- package/api-type/src/modules/scout_profile/handlers/scout_profile_sport.config.d.ts +12 -0
- package/api-type/src/modules/scout_profile/scout_profile.schema.d.ts +1528 -189
- package/api-type/src/modules/scout_profile/scout_profile.service.d.ts +11 -31
- package/api-type/src/modules/scout_profile/scout_softball_profile.model.d.ts +44 -0
- package/api-type/src/modules/team/team.schema.d.ts +3 -0
- package/api-type/src/modules/transaction/transaction.service.d.ts +1 -1
- package/api-type/src/trpcRouter/free_agent_payments.router.d.ts +2 -1
- package/api-type/src/trpcRouter/join_request.router.d.ts +125 -0
- package/api-type/src/trpcRouter/league_invite.router.d.ts +26 -0
- package/api-type/src/trpcRouter/league_payments.router.d.ts +1 -0
- package/api-type/src/trpcRouter/pickup_group_invite.router.d.ts +23 -0
- package/api-type/src/trpcRouter/router.d.ts +967 -107
- package/api-type/src/trpcRouter/scout_feed.router.d.ts +214 -7
- package/api-type/src/trpcRouter/scout_profile.router.d.ts +72 -26
- package/api-type/src/trpcRouter/team.d.ts +1 -0
- package/api-type/src/types/dynamic_season_league_template.d.ts +2 -1
- package/api-type/src/types/free_agent.d.ts +2 -2
- package/api-type/src/types/league.d.ts +9 -0
- package/api-type/src/types/marketplace.d.ts +9 -2
- package/api-type/src/types/pickup.d.ts +3 -1
- package/api-type/src/types/pickup_group.d.ts +3 -0
- package/api-type/src/types/season_league_template.d.ts +2 -1
- package/dist/index.d.ts +1436 -146
- package/dist/index.d.ts.map +1 -1
- package/dist/provider.d.ts +967 -107
- package/dist/provider.d.ts.map +1 -1
- package/dist/query.d.ts +464 -34
- package/dist/query.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { JoinRequest } from '@prisma/client';
|
|
1
2
|
import prisma from '../../database/prisma';
|
|
2
3
|
import { CHAT_TYPES, type CreatePrivateGroupInput, type ListChatsInput, type GetMessagesInput } from './chat.schema';
|
|
4
|
+
import type { JoinRequestNotificationMetadata, JoinRequestTargetType } from '../join_request/join_request.schema';
|
|
3
5
|
type PrismaClientLike = typeof prisma;
|
|
4
6
|
type DbClient = any;
|
|
5
7
|
type CreateContextChatInput = {
|
|
@@ -39,6 +41,25 @@ type CreateScoutInviteMessageInput = {
|
|
|
39
41
|
metaData: Record<string, unknown>;
|
|
40
42
|
};
|
|
41
43
|
};
|
|
44
|
+
type CreateJoinRequestMessageInput = {
|
|
45
|
+
chatId: number;
|
|
46
|
+
senderId: number;
|
|
47
|
+
requesterId: number;
|
|
48
|
+
content: string;
|
|
49
|
+
targetType: JoinRequestTargetType;
|
|
50
|
+
targetId: number;
|
|
51
|
+
adminMemberId: number;
|
|
52
|
+
notification: {
|
|
53
|
+
text: string;
|
|
54
|
+
textMeta: string;
|
|
55
|
+
metaData: JoinRequestNotificationMetadata;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type CreateJoinRequestMessageResult = {
|
|
59
|
+
joinRequest: JoinRequest;
|
|
60
|
+
chatMessage: Awaited<ReturnType<ChatRepository['getChatMessageWithDetails']>>;
|
|
61
|
+
notificationMemberIds: number[];
|
|
62
|
+
};
|
|
42
63
|
type ReactionInput = {
|
|
43
64
|
chatId: number;
|
|
44
65
|
messageId: string;
|
|
@@ -74,6 +95,11 @@ export declare class ChatRepository {
|
|
|
74
95
|
getScoutInviteByMessageId(messageId: string): Promise<any>;
|
|
75
96
|
listScoutInvites(memberId: number, status?: string): Promise<any>;
|
|
76
97
|
updateScoutInviteStatus(inviteId: number, status: string): Promise<any>;
|
|
98
|
+
createJoinRequestMessage(input: CreateJoinRequestMessageInput): Promise<CreateJoinRequestMessageResult>;
|
|
99
|
+
getJoinRequestById(joinRequestId: number): Promise<JoinRequest | null>;
|
|
100
|
+
getPendingJoinRequest(requesterId: number, targetType: JoinRequestTargetType, targetId: number): Promise<JoinRequest | null>;
|
|
101
|
+
listJoinRequestsForMember(memberId: number, status?: string): Promise<JoinRequest[]>;
|
|
102
|
+
updateJoinRequestStatus(joinRequestId: number, status: string, respondedById: number | null): Promise<JoinRequest>;
|
|
77
103
|
votePoll(chatId: number, pollId: number, memberId: number, optionIds: number[]): Promise<any>;
|
|
78
104
|
sendReaction(input: ReactionInput): Promise<any>;
|
|
79
105
|
removeReaction(chatId: number, messageId: string, memberId: number): Promise<{
|
|
@@ -21,6 +21,7 @@ export declare const CHAT_MESSAGE_TYPES: {
|
|
|
21
21
|
readonly TEXT: "text";
|
|
22
22
|
readonly POLL: "poll";
|
|
23
23
|
readonly INVITE: "invite";
|
|
24
|
+
readonly JOIN_REQUEST: "join_request";
|
|
24
25
|
};
|
|
25
26
|
export declare const chatTypeSchema: z.ZodEnum<["direct", "private_group", "team", "match", "pickup_group", "pickup"]>;
|
|
26
27
|
export declare const chatMemberRoleSchema: z.ZodEnum<["owner", "admin", "member"]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChatRepository } from './chat.repository';
|
|
2
2
|
import { type AddMembersInput, type BlockPlayerInput, type ContextChatInput, type CreateDirectChatInput, type CreatePollInput, type CreatePrivateGroupInput, type GetMessagesInput, type ListGroupMemberCandidatesInput, type ListChatsInput, type MessageActionInput, type MemberChatModerationInput, type MemberChatStateInput, type MessageReactionInput, type RemoveMessageReactionInput, type RemoveMemberInput, type SearchMessagesInput, type SendMessageInput, type SetMessageHighlightedInput, type TransferOwnershipInput, type UpdateChatInput, type VotePollInput } from './chat.schema';
|
|
3
|
+
import type { JoinRequestNotificationMetadata, JoinRequestTargetType } from '../join_request/join_request.schema';
|
|
3
4
|
type SendScoutInviteMessageInput = {
|
|
4
5
|
chatId: number;
|
|
5
6
|
content: string;
|
|
@@ -15,6 +16,19 @@ type SendScoutInviteMessageInput = {
|
|
|
15
16
|
metaData: Record<string, unknown>;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
19
|
+
type SendJoinRequestMessageInput = {
|
|
20
|
+
chatId: number;
|
|
21
|
+
content: string;
|
|
22
|
+
requesterId: number;
|
|
23
|
+
targetType: JoinRequestTargetType;
|
|
24
|
+
targetId: number;
|
|
25
|
+
adminMemberId: number;
|
|
26
|
+
notification: {
|
|
27
|
+
text: string;
|
|
28
|
+
textMeta: string;
|
|
29
|
+
metaData: JoinRequestNotificationMetadata;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
18
32
|
export declare class ChatService {
|
|
19
33
|
private readonly repository;
|
|
20
34
|
constructor(repository?: ChatRepository);
|
|
@@ -58,6 +72,11 @@ export declare class ChatService {
|
|
|
58
72
|
syncPickupChat(pickupId: number, actorId?: number): Promise<any>;
|
|
59
73
|
sendMessage(actorId: number, input: SendMessageInput): Promise<any>;
|
|
60
74
|
sendScoutInviteMessage(actorId: number, input: SendScoutInviteMessageInput): Promise<any>;
|
|
75
|
+
sendJoinRequestMessage(actorId: number, input: SendJoinRequestMessageInput): Promise<{
|
|
76
|
+
joinRequest: JoinRequest;
|
|
77
|
+
chatMessage: Awaited<ReturnType<ChatRepository["getChatMessageWithDetails"]>>;
|
|
78
|
+
notificationMemberIds: number[];
|
|
79
|
+
}>;
|
|
61
80
|
createPoll(actorId: number, input: CreatePollInput): Promise<any>;
|
|
62
81
|
votePoll(actorId: number, input: VotePollInput): Promise<any>;
|
|
63
82
|
sendReaction(actorId: number, input: MessageReactionInput): Promise<any>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const FreeAgentPaymentSchema: z.ZodObject<{
|
|
3
3
|
freeAgentId: z.ZodNumber;
|
|
4
4
|
leagueId: z.ZodOptional<z.ZodNumber>;
|
|
5
|
-
description: z.ZodString
|
|
5
|
+
description: z.ZodNullable<z.ZodString>;
|
|
6
6
|
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
7
7
|
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
8
8
|
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
@@ -10,14 +10,14 @@ export declare const FreeAgentPaymentSchema: z.ZodObject<{
|
|
|
10
10
|
deletedAt: Date | null;
|
|
11
11
|
createdAt: string | Date;
|
|
12
12
|
updatedAt: string | Date;
|
|
13
|
-
description: string;
|
|
13
|
+
description: string | null;
|
|
14
14
|
freeAgentId: number;
|
|
15
15
|
leagueId?: number | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
deletedAt: Date | null;
|
|
18
18
|
createdAt: string | Date;
|
|
19
19
|
updatedAt: string | Date;
|
|
20
|
-
description: string;
|
|
20
|
+
description: string | null;
|
|
21
21
|
freeAgentId: number;
|
|
22
22
|
leagueId?: number | undefined;
|
|
23
23
|
}>;
|
|
@@ -25,28 +25,32 @@ export type FreeAgentPaymentSchema = z.infer<typeof FreeAgentPaymentSchema>;
|
|
|
25
25
|
export declare const RegistrationCheckoutSchema: z.ZodObject<Pick<{
|
|
26
26
|
freeAgentId: z.ZodNumber;
|
|
27
27
|
leagueId: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
description: z.ZodString
|
|
28
|
+
description: z.ZodNullable<z.ZodString>;
|
|
29
29
|
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
30
30
|
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
31
31
|
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
32
|
-
}, "
|
|
32
|
+
}, "leagueId" | "freeAgentId"> & {
|
|
33
|
+
description: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
33
34
|
code: z.ZodOptional<z.ZodString>;
|
|
34
35
|
paymentMode: z.ZodDefault<z.ZodEnum<["session", "intent"]>>;
|
|
35
36
|
cancelPath: z.ZodOptional<z.ZodString>;
|
|
37
|
+
inviteToken: z.ZodOptional<z.ZodString>;
|
|
36
38
|
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
description: string;
|
|
39
|
+
description: string | null;
|
|
38
40
|
paymentMode: "session" | "intent";
|
|
39
41
|
freeAgentId: number;
|
|
40
42
|
leagueId?: number | undefined;
|
|
41
43
|
code?: string | undefined;
|
|
42
44
|
cancelPath?: string | undefined;
|
|
45
|
+
inviteToken?: string | undefined;
|
|
43
46
|
}, {
|
|
44
|
-
description: string;
|
|
47
|
+
description: string | null;
|
|
45
48
|
freeAgentId: number;
|
|
46
49
|
leagueId?: number | undefined;
|
|
47
50
|
code?: string | undefined;
|
|
48
51
|
paymentMode?: "session" | "intent" | undefined;
|
|
49
52
|
cancelPath?: string | undefined;
|
|
53
|
+
inviteToken?: string | undefined;
|
|
50
54
|
}>;
|
|
51
55
|
export type RegistrationCheckoutSchema = z.infer<typeof RegistrationCheckoutSchema>;
|
|
52
56
|
export declare const ToggleArchiveSchema: z.ZodObject<{
|
|
@@ -20,7 +20,7 @@ export declare class FreeAgentPaymentsService {
|
|
|
20
20
|
registerFreeAgentWithoutPayment(options: {
|
|
21
21
|
memberId: number;
|
|
22
22
|
orgFreeAgentId: number;
|
|
23
|
-
description: string;
|
|
23
|
+
description: string | null;
|
|
24
24
|
amount: number;
|
|
25
25
|
idempotencyKey: string;
|
|
26
26
|
orgFreeAgentPrice: OrgFreeAgentPrice;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const JOIN_REQUEST_TARGET_TYPES: {
|
|
3
|
+
readonly PICKUP_GROUP: "PICKUP_GROUP";
|
|
4
|
+
readonly LEAGUE: "LEAGUE";
|
|
5
|
+
readonly TEAM: "TEAM";
|
|
6
|
+
};
|
|
7
|
+
export declare const JOIN_REQUEST_STATUSES: {
|
|
8
|
+
readonly PENDING: "PENDING";
|
|
9
|
+
readonly ACCEPTED: "ACCEPTED";
|
|
10
|
+
readonly DECLINED: "DECLINED";
|
|
11
|
+
readonly CANCELED: "CANCELED";
|
|
12
|
+
readonly EXPIRED: "EXPIRED";
|
|
13
|
+
};
|
|
14
|
+
export type JoinRequestTargetType = (typeof JOIN_REQUEST_TARGET_TYPES)[keyof typeof JOIN_REQUEST_TARGET_TYPES];
|
|
15
|
+
export type JoinRequestStatus = (typeof JOIN_REQUEST_STATUSES)[keyof typeof JOIN_REQUEST_STATUSES];
|
|
16
|
+
export type JoinRequestNotificationMetadata = {
|
|
17
|
+
chatId: number;
|
|
18
|
+
requesterId: number;
|
|
19
|
+
targetType: JoinRequestTargetType;
|
|
20
|
+
targetId: number;
|
|
21
|
+
targetName: string;
|
|
22
|
+
joinRequestId?: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const createJoinRequestInputSchema: z.ZodObject<{
|
|
25
|
+
targetType: z.ZodEnum<["PICKUP_GROUP", "LEAGUE", "TEAM"]>;
|
|
26
|
+
targetId: z.ZodNumber;
|
|
27
|
+
message: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
message: string;
|
|
30
|
+
targetId: number;
|
|
31
|
+
targetType: "LEAGUE" | "PICKUP_GROUP" | "TEAM";
|
|
32
|
+
}, {
|
|
33
|
+
message: string;
|
|
34
|
+
targetId: number;
|
|
35
|
+
targetType: "LEAGUE" | "PICKUP_GROUP" | "TEAM";
|
|
36
|
+
}>;
|
|
37
|
+
export declare const joinRequestIdInputSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodNumber;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
id: number;
|
|
41
|
+
}, {
|
|
42
|
+
id: number;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const listJoinRequestsInputSchema: z.ZodObject<{
|
|
45
|
+
status: z.ZodOptional<z.ZodEnum<["PENDING", "ACCEPTED", "DECLINED", "CANCELED", "EXPIRED"]>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
status?: "PENDING" | "EXPIRED" | "CANCELED" | "ACCEPTED" | "DECLINED" | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
status?: "PENDING" | "EXPIRED" | "CANCELED" | "ACCEPTED" | "DECLINED" | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
export type CreateJoinRequestInput = z.infer<typeof createJoinRequestInputSchema>;
|
|
52
|
+
export type JoinRequestIdInput = z.infer<typeof joinRequestIdInputSchema>;
|
|
53
|
+
export type ListJoinRequestsInput = z.infer<typeof listJoinRequestsInputSchema>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ChatRepository } from '../chat/chat.repository';
|
|
2
|
+
import { ChatService } from '../chat/chat.service';
|
|
3
|
+
import { type CreateJoinRequestInput, type JoinRequestIdInput, type ListJoinRequestsInput } from './join_request.schema';
|
|
4
|
+
/**
|
|
5
|
+
* Player-initiated request-to-join flow. Mirror of `ScoutInviteService` in
|
|
6
|
+
* reverse: requester (player) → admin (member). v1 only supports PICKUP_GROUP;
|
|
7
|
+
* LEAGUE / TEAM throw NOT_IMPLEMENTED on create + accept until the target
|
|
8
|
+
* membership tables are wired in.
|
|
9
|
+
*/
|
|
10
|
+
export declare class JoinRequestService {
|
|
11
|
+
private readonly chatService;
|
|
12
|
+
private readonly chatRepository;
|
|
13
|
+
constructor(chatService: ChatService, chatRepository: ChatRepository);
|
|
14
|
+
create(actorId: number, input: CreateJoinRequestInput): Promise<{
|
|
15
|
+
joinRequestId: any;
|
|
16
|
+
chatId: any;
|
|
17
|
+
messageId: any;
|
|
18
|
+
status: any;
|
|
19
|
+
joinRequest: JoinRequest;
|
|
20
|
+
alreadyPending: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
joinRequestId: any;
|
|
23
|
+
chatId: any;
|
|
24
|
+
messageId: any;
|
|
25
|
+
status: any;
|
|
26
|
+
joinRequest: JoinRequest;
|
|
27
|
+
alreadyResponded: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
alreadyPending: false;
|
|
30
|
+
joinRequestId: any;
|
|
31
|
+
chatId: any;
|
|
32
|
+
messageId: any;
|
|
33
|
+
status: "PENDING";
|
|
34
|
+
chat: any;
|
|
35
|
+
chatMessage: any;
|
|
36
|
+
notificationMemberIds: number[];
|
|
37
|
+
}>;
|
|
38
|
+
accept(actorId: number, input: JoinRequestIdInput): Promise<{
|
|
39
|
+
joinRequestId: any;
|
|
40
|
+
chatId: any;
|
|
41
|
+
messageId: any;
|
|
42
|
+
status: any;
|
|
43
|
+
joinRequest: JoinRequest;
|
|
44
|
+
alreadyPending: boolean;
|
|
45
|
+
} | {
|
|
46
|
+
joinRequestId: any;
|
|
47
|
+
chatId: any;
|
|
48
|
+
messageId: any;
|
|
49
|
+
status: any;
|
|
50
|
+
joinRequest: JoinRequest;
|
|
51
|
+
alreadyResponded: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
decline(actorId: number, input: JoinRequestIdInput): Promise<{
|
|
54
|
+
joinRequestId: any;
|
|
55
|
+
chatId: any;
|
|
56
|
+
messageId: any;
|
|
57
|
+
status: any;
|
|
58
|
+
joinRequest: JoinRequest;
|
|
59
|
+
alreadyPending: boolean;
|
|
60
|
+
} | {
|
|
61
|
+
joinRequestId: any;
|
|
62
|
+
chatId: any;
|
|
63
|
+
messageId: any;
|
|
64
|
+
status: any;
|
|
65
|
+
joinRequest: JoinRequest;
|
|
66
|
+
alreadyResponded: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
cancel(actorId: number, input: JoinRequestIdInput): Promise<{
|
|
69
|
+
joinRequestId: any;
|
|
70
|
+
chatId: any;
|
|
71
|
+
messageId: any;
|
|
72
|
+
status: any;
|
|
73
|
+
joinRequest: JoinRequest;
|
|
74
|
+
alreadyPending: boolean;
|
|
75
|
+
} | {
|
|
76
|
+
joinRequestId: any;
|
|
77
|
+
chatId: any;
|
|
78
|
+
messageId: any;
|
|
79
|
+
status: any;
|
|
80
|
+
joinRequest: JoinRequest;
|
|
81
|
+
alreadyResponded: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
get(actorId: number, input: JoinRequestIdInput): Promise<JoinRequest>;
|
|
84
|
+
list(actorId: number, input: ListJoinRequestsInput): Promise<JoinRequest[]>;
|
|
85
|
+
private buildResult;
|
|
86
|
+
private requireJoinRequest;
|
|
87
|
+
/**
|
|
88
|
+
* Validates target is pickup group in invite-only mode, requester isn't
|
|
89
|
+
* already a member, and picks the primary admin (member) to route the card
|
|
90
|
+
* to. Throws with a specific message per failure mode so the frontend can
|
|
91
|
+
* surface something meaningful.
|
|
92
|
+
*/
|
|
93
|
+
private resolvePickupGroupTarget;
|
|
94
|
+
/**
|
|
95
|
+
* Primary admin = creator if they're still an active (non-blocked) member,
|
|
96
|
+
* otherwise the oldest active admin. Chat is member-only, so organizer
|
|
97
|
+
* creators of org-managed groups can't receive the card — a member-admin
|
|
98
|
+
* must exist for the flow to work.
|
|
99
|
+
*/
|
|
100
|
+
private pickPickupGroupPrimaryAdminMemberId;
|
|
101
|
+
private requireCurrentAdmin;
|
|
102
|
+
private sendPushNotification;
|
|
103
|
+
private backfillJoinRequestIdOnNotifications;
|
|
104
|
+
private getMember;
|
|
105
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GetOrCreateLeagueInviteInputSchema: z.ZodObject<{
|
|
3
|
+
leagueId: z.ZodNumber;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
leagueId: number;
|
|
6
|
+
}, {
|
|
7
|
+
leagueId: number;
|
|
8
|
+
}>;
|
|
9
|
+
export type GetOrCreateLeagueInviteInput = z.infer<typeof GetOrCreateLeagueInviteInputSchema>;
|
|
10
|
+
export declare const ValidateLeagueInviteInputSchema: z.ZodObject<{
|
|
11
|
+
leagueId: z.ZodNumber;
|
|
12
|
+
token: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
leagueId: number;
|
|
15
|
+
token: string;
|
|
16
|
+
}, {
|
|
17
|
+
leagueId: number;
|
|
18
|
+
token: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type ValidateLeagueInviteInput = z.infer<typeof ValidateLeagueInviteInputSchema>;
|
|
21
|
+
export type LeagueInviteLinkResp = {
|
|
22
|
+
url: string;
|
|
23
|
+
token: string;
|
|
24
|
+
expiresAt: string;
|
|
25
|
+
};
|
|
26
|
+
export type LeagueInviteValidationResp = {
|
|
27
|
+
valid: boolean;
|
|
28
|
+
expiresAt?: string;
|
|
29
|
+
reason?: 'not_found' | 'expired' | 'inactive' | 'wrong_league';
|
|
30
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TransactionOrKnex } from 'objection';
|
|
2
|
+
import { Invite } from '../../models/invite';
|
|
3
|
+
import { League } from '../../models/league';
|
|
4
|
+
import { Organizer } from '../../models/organizer';
|
|
5
|
+
import type { GetOrCreateLeagueInviteInput, LeagueInviteLinkResp, LeagueInviteValidationResp, ValidateLeagueInviteInput } from './league_invite.schema';
|
|
6
|
+
export declare class LeagueInviteService {
|
|
7
|
+
private readonly InviteModel;
|
|
8
|
+
private readonly LeagueModel;
|
|
9
|
+
constructor(InviteModel: typeof Invite, LeagueModel: typeof League);
|
|
10
|
+
getOrCreate(input: GetOrCreateLeagueInviteInput, organizer: Organizer): Promise<LeagueInviteLinkResp>;
|
|
11
|
+
/**
|
|
12
|
+
* Deactivates every active `league_registration` invite for the league.
|
|
13
|
+
* Called when a league transitions to PUBLIC — prior tokens should not carry
|
|
14
|
+
* over into a future INVITE_ONLY phase.
|
|
15
|
+
* Returns the number of rows updated.
|
|
16
|
+
*/
|
|
17
|
+
invalidateAllActive(leagueId: number, trx?: TransactionOrKnex): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Recomputes the expiration of active (non-expired) invites using the current
|
|
20
|
+
* league state. Called when `startDate` changes so the boundary stays aligned
|
|
21
|
+
* with the new schedule — treats the update moment as the generation moment.
|
|
22
|
+
* Returns the number of rows updated.
|
|
23
|
+
*/
|
|
24
|
+
refreshExpirationForActive(league: League, trx?: TransactionOrKnex): Promise<number>;
|
|
25
|
+
validate(input: ValidateLeagueInviteInput): Promise<LeagueInviteValidationResp>;
|
|
26
|
+
private resolveExpiration;
|
|
27
|
+
private generateToken;
|
|
28
|
+
private buildInviteUrl;
|
|
29
|
+
}
|
|
@@ -312,6 +312,7 @@ export declare const RegistrationCheckoutSchema: z.ZodObject<Pick<{
|
|
|
312
312
|
paymentMode: z.ZodDefault<z.ZodEnum<["session", "intent"]>>;
|
|
313
313
|
paymentAmount: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
314
314
|
cancelPath: z.ZodOptional<z.ZodString>;
|
|
315
|
+
inviteToken: z.ZodOptional<z.ZodString>;
|
|
315
316
|
}, "strip", z.ZodTypeAny, {
|
|
316
317
|
teamId: number;
|
|
317
318
|
leagueId: number;
|
|
@@ -320,6 +321,7 @@ export declare const RegistrationCheckoutSchema: z.ZodObject<Pick<{
|
|
|
320
321
|
code?: string | undefined;
|
|
321
322
|
paymentAmount?: number | undefined;
|
|
322
323
|
cancelPath?: string | undefined;
|
|
324
|
+
inviteToken?: string | undefined;
|
|
323
325
|
}, {
|
|
324
326
|
teamId: number;
|
|
325
327
|
leagueId: number;
|
|
@@ -328,5 +330,6 @@ export declare const RegistrationCheckoutSchema: z.ZodObject<Pick<{
|
|
|
328
330
|
paymentMode?: "session" | "intent" | undefined;
|
|
329
331
|
paymentAmount?: number | undefined;
|
|
330
332
|
cancelPath?: string | undefined;
|
|
333
|
+
inviteToken?: string | undefined;
|
|
331
334
|
}>;
|
|
332
335
|
export type RegistrationCheckoutSchema = z.infer<typeof RegistrationCheckoutSchema>;
|
|
@@ -26,7 +26,7 @@ export declare class LeaguePaymentsService {
|
|
|
26
26
|
insertOfflinePayment(organizerId: number, { teamRosterId, leagueId, price, offlineMethod }: InsertOfflinePaymentInputSchema): Promise<void>;
|
|
27
27
|
updateOfflinePayment(organizerId: number, { id: paymentId, offlineMethod, price }: UpdateOfflinePaymentInputSchema): Promise<void>;
|
|
28
28
|
deleteOfflinePayment(organizerId: number, { id: paymentId }: DeleteOfflinePaymentInputSchema): Promise<void>;
|
|
29
|
-
registrationCheckout(memberId: number, { leagueId, teamId, paymentType, code, paymentMode, paymentAmount, cancelPath }: RegistrationCheckoutSchema): Promise<{
|
|
29
|
+
registrationCheckout(memberId: number, { leagueId, teamId, paymentType, code, paymentMode, paymentAmount, cancelPath, inviteToken }: RegistrationCheckoutSchema): Promise<{
|
|
30
30
|
customerId: string;
|
|
31
31
|
ephemeralKey?: string;
|
|
32
32
|
orgPublishableKey?: string;
|
|
@@ -50,6 +50,10 @@ export declare enum LeagueFormat {
|
|
|
50
50
|
Ten_V_Ten = "10v10",
|
|
51
51
|
Eleven_V_Eleven = "11v11"
|
|
52
52
|
}
|
|
53
|
+
export declare enum RegistrationPolicy {
|
|
54
|
+
PUBLIC = "PUBLIC",
|
|
55
|
+
INVITE_ONLY = "INVITE_ONLY"
|
|
56
|
+
}
|
|
53
57
|
type TCoordinator = {
|
|
54
58
|
id: number;
|
|
55
59
|
firstName: string;
|
|
@@ -109,6 +113,7 @@ export type TLeagueExtraProductInfo = {
|
|
|
109
113
|
locations?: string[];
|
|
110
114
|
addresses?: Pick<TAddress, 'id' | 'location' | 'formattedAddress'>[];
|
|
111
115
|
startTimes?: string[];
|
|
116
|
+
registrationPolicy?: RegistrationPolicy | null;
|
|
112
117
|
};
|
|
113
118
|
export type TPickupExtraProductInfo = {
|
|
114
119
|
date: string;
|
|
@@ -126,6 +131,7 @@ export type TPickupExtraProductInfo = {
|
|
|
126
131
|
} | null;
|
|
127
132
|
isFull?: boolean;
|
|
128
133
|
gender?: Gender;
|
|
134
|
+
registrationPolicy?: 'PUBLIC' | 'INVITE_ONLY';
|
|
129
135
|
};
|
|
130
136
|
export type TFreeAgentExtraProductInfo = {
|
|
131
137
|
isPublished: boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CreatePickupGroupInviteSchema: z.ZodObject<{
|
|
3
|
+
pickupGroupId: z.ZodNumber;
|
|
4
|
+
invites: z.ZodArray<z.ZodObject<{
|
|
5
|
+
email: z.ZodString;
|
|
6
|
+
firstName: z.ZodString;
|
|
7
|
+
lastName: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
email: string;
|
|
12
|
+
}, {
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
email: string;
|
|
16
|
+
}>, "many">;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
pickupGroupId: number;
|
|
19
|
+
invites: {
|
|
20
|
+
firstName: string;
|
|
21
|
+
lastName: string;
|
|
22
|
+
email: string;
|
|
23
|
+
}[];
|
|
24
|
+
}, {
|
|
25
|
+
pickupGroupId: number;
|
|
26
|
+
invites: {
|
|
27
|
+
firstName: string;
|
|
28
|
+
lastName: string;
|
|
29
|
+
email: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
32
|
+
export type CreatePickupGroupInviteSchema = z.infer<typeof CreatePickupGroupInviteSchema>;
|
|
33
|
+
export type CreatePickupGroupInviteResp = {
|
|
34
|
+
invites: Array<{
|
|
35
|
+
id: number;
|
|
36
|
+
email: string;
|
|
37
|
+
firstName: string | null;
|
|
38
|
+
lastName: string | null;
|
|
39
|
+
isActive: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Invite } from '../../models/invite';
|
|
2
|
+
import { PickupGroup } from '../../models/pickup_group';
|
|
3
|
+
import { PickupGrpMember } from '../../models/pickup_group_members';
|
|
4
|
+
import { Member } from '../../models/member';
|
|
5
|
+
import { AuthService } from '../auth/auth.service';
|
|
6
|
+
import type { CreatePickupGroupInviteResp, CreatePickupGroupInviteSchema } from './pickup_group_invite.schema';
|
|
7
|
+
export declare class PickupGroupInviteService {
|
|
8
|
+
private readonly InviteModel;
|
|
9
|
+
private readonly PickupGroupModel;
|
|
10
|
+
private readonly PickupGrpMemberModel;
|
|
11
|
+
private readonly MemberModel;
|
|
12
|
+
private readonly authService;
|
|
13
|
+
constructor(InviteModel: typeof Invite, PickupGroupModel: typeof PickupGroup, PickupGrpMemberModel: typeof PickupGrpMember, MemberModel: typeof Member, authService: AuthService);
|
|
14
|
+
createByMember(memberId: number, payload: CreatePickupGroupInviteSchema): Promise<CreatePickupGroupInviteResp>;
|
|
15
|
+
private buildRegistrationLink;
|
|
16
|
+
private ensureInvitedMemberAndInvite;
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MULTI_SPORT_ENUM } from '../../scout_profile/scout_profile.schema';
|
|
2
|
+
import { GetFeedFiltersInputSchema, GetFeedOutputSchema } from '../scout_feed.schema';
|
|
3
|
+
export interface ScoutFeedHandler {
|
|
4
|
+
sport: MULTI_SPORT_ENUM;
|
|
5
|
+
getFeed(memberId: number, input: GetFeedFiltersInputSchema): Promise<GetFeedOutputSchema>;
|
|
6
|
+
getProfilesForFeed(filters: {
|
|
7
|
+
genders?: string[];
|
|
8
|
+
positions?: number[];
|
|
9
|
+
minAge?: number;
|
|
10
|
+
roles?: string[];
|
|
11
|
+
availableSlots?: number[];
|
|
12
|
+
filterMaxTDistWithMargin?: number;
|
|
13
|
+
inputCoordinates?: {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
};
|
|
17
|
+
profileIds?: number[];
|
|
18
|
+
skillLevels?: number[];
|
|
19
|
+
excludeReqMemberId?: number;
|
|
20
|
+
}): Promise<FeedProfile[]>;
|
|
21
|
+
}
|
|
22
|
+
type FeedProfile = {
|
|
23
|
+
id?: number;
|
|
24
|
+
memberId?: number;
|
|
25
|
+
pinned?: boolean;
|
|
26
|
+
weightedTotalScore?: number;
|
|
27
|
+
toJSON?: () => Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|