|
@@ -179,17 +179,13 @@ export class AuthService {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // ---------------------------
|
|
|
|
|
- // Channel resolution (box-admin)
|
|
|
|
|
- // ---------------------------
|
|
|
|
|
-
|
|
|
|
|
private async resolveFirstLoginChannel(
|
|
private async resolveFirstLoginChannel(
|
|
|
channelIdInput?: string,
|
|
channelIdInput?: string,
|
|
|
): Promise<any> {
|
|
): Promise<any> {
|
|
|
- // 1) If client provided channelId, validate it exists
|
|
|
|
|
|
|
+ // 1) If client provided channelId, match channel by name, validate it exists
|
|
|
if (channelIdInput) {
|
|
if (channelIdInput) {
|
|
|
- const byId = await this.getChannelByChannelId(channelIdInput);
|
|
|
|
|
- if (byId) return byId;
|
|
|
|
|
|
|
+ const byName = await this.getChannelByChannelName(channelIdInput);
|
|
|
|
|
+ if (byName) return byName;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 2) Use default channel where isDefault=true
|
|
// 2) Use default channel where isDefault=true
|
|
@@ -206,6 +202,14 @@ export class AuthService {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private async getChannelByChannelName(
|
|
|
|
|
+ channelName: string,
|
|
|
|
|
+ ): Promise<any | null> {
|
|
|
|
|
+ return this.prismaMongoService.channel.findUnique({
|
|
|
|
|
+ where: { name: channelName },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private async getChannelByChannelId(channelId: string): Promise<any | null> {
|
|
private async getChannelByChannelId(channelId: string): Promise<any | null> {
|
|
|
return this.prismaMongoService.channel.findUnique({
|
|
return this.prismaMongoService.channel.findUnique({
|
|
|
where: { channelId },
|
|
where: { channelId },
|