global fix and add tauri app

This commit is contained in:
lendry
2026-06-26 13:56:54 +03:00
parent aa228d84eb
commit 3b05b7e4d4
50 changed files with 3947 additions and 80 deletions

View File

@@ -11,6 +11,7 @@ COPY apps/sso-core/package.json ./apps/sso-core/
COPY apps/api-gateway/package.json ./apps/api-gateway/
COPY apps/frontend/package.json ./apps/frontend/
COPY apps/docs/package.json ./apps/docs/
COPY tauri_app/package.json ./tauri_app/
RUN --mount=type=cache,target=/root/.npm \
npm config set registry "${NPM_REGISTRY}" && \

View File

@@ -418,6 +418,7 @@ model ChatRoomMember {
roomId String
userId String
notificationsMuted Boolean @default(false)
pinnedAt DateTime?
lastReadAt DateTime?
lastReadMessageId String?
joinedAt DateTime @default(now())
@@ -425,6 +426,7 @@ model ChatRoomMember {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([roomId, userId])
@@index([userId, pinnedAt])
}
model ChatMessage {

View File

@@ -985,8 +985,8 @@ export class AuthGrpcController {
}
@GrpcMethod('ChatService', 'UpdateRoomSettings')
updateChatRoomSettings(command: { userId: string; roomId: string; name?: string; notificationsMuted?: boolean }) {
return this.chat.updateRoomSettings(command.userId, command.roomId, command.name, command.notificationsMuted);
updateChatRoomSettings(command: { userId: string; roomId: string; name?: string; notificationsMuted?: boolean; pinned?: boolean }) {
return this.chat.updateRoomSettings(command.userId, command.roomId, command.name, command.notificationsMuted, command.pinned);
}
@GrpcMethod('ChatService', 'AddRoomMember')

View File

@@ -104,6 +104,11 @@ export class ChatService {
);
formatted.sort((a, b) => {
const pinDiff = Number(Boolean(b.isPinned)) - Number(Boolean(a.isPinned));
if (pinDiff !== 0) return pinDiff;
if (a.isPinned && b.isPinned) {
return (b.pinnedAt ?? '').localeCompare(a.pinnedAt ?? '');
}
const rank = (type: string) => (type === 'GENERAL' ? 0 : 1);
const rankDiff = rank(a.type) - rank(b.type);
if (rankDiff !== 0) return rankDiff;
@@ -360,7 +365,7 @@ export class ChatService {
return this.getRoomResponse(roomId, userId);
}
async updateRoomSettings(userId: string, roomId: string, name?: string, notificationsMuted?: boolean) {
async updateRoomSettings(userId: string, roomId: string, name?: string, notificationsMuted?: boolean, pinned?: boolean) {
const room = await this.getRoomForMember(roomId, userId);
if (name !== undefined) {
const trimmedName = name.trim();
@@ -381,6 +386,12 @@ export class ChatService {
data: { notificationsMuted }
});
}
if (pinned !== undefined) {
await this.prisma.chatRoomMember.update({
where: { roomId_userId: { roomId, userId } },
data: { pinnedAt: pinned ? new Date() : null }
});
}
return this.getRoomResponse(roomId, userId);
}
@@ -903,6 +914,7 @@ export class ChatService {
id: string;
userId: string;
notificationsMuted: boolean;
pinnedAt?: Date | null;
user: { displayName: string; avatarStorageKey: string | null; isVerified: boolean; verificationIcon: string | null };
}>;
},
@@ -910,6 +922,7 @@ export class ChatService {
lastMessage?: Awaited<ReturnType<ChatService['toMessage']>>,
viewerId?: string
) {
const viewerMembership = viewerId ? room.members.find((member) => member.userId === viewerId) : undefined;
const peerMember =
viewerId && (room.type === 'DIRECT' || room.type === 'BOT' || room.type === 'E2E')
? room.members.find((member) => member.userId !== viewerId)
@@ -926,6 +939,8 @@ export class ChatService {
hasAvatar: room.hasAvatar,
createdById: room.createdById ?? undefined,
updatedAt: room.updatedAt.toISOString(),
isPinned: Boolean(viewerMembership?.pinnedAt),
pinnedAt: viewerMembership?.pinnedAt?.toISOString(),
members: room.members.map((member) => ({
id: member.id,
userId: member.userId,
@@ -934,6 +949,8 @@ export class ChatService {
isVerified: member.user.isVerified,
verificationIcon: member.user.isVerified ? resolveVerificationIcon(member.user.verificationIcon) : undefined,
notificationsMuted: member.notificationsMuted,
isPinned: Boolean(member.pinnedAt),
pinnedAt: member.pinnedAt?.toISOString(),
familyRole: familyRoleByUserId.get(member.userId) ?? 'member',
isChatCreator: room.createdById === member.userId
})),