diff --git a/package.json b/package.json index 39d6abb..a9b07fc 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "gen:api": "npx swagger-typescript-api@12.0.4 -p http://localhost:1337/api/docs-json -o ./src/api -n api.ts --axios --unwrap-response-data --extract-request-params --extract-request-body --single-http-client" }, "dependencies": { - "@tanstack/vue-query": "^5.101.0", "@floating-ui/vue": "^1.1.5", + "@tanstack/vue-query": "^5.101.0", "@tauri-apps/api": "^2", "@tauri-apps/plugin-dialog": "^2", "@tauri-apps/plugin-shell": "^2", @@ -25,6 +25,7 @@ "esbuild": "^0.28.0", "gsap": "^3.12.5", "leaflet": "^1.9.4", + "socket.io-client": "^4.8.3", "vue": "^3.5.6", "vue-router": "^4.4.5" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59c8019..6f35f3d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,6 +46,9 @@ importers: leaflet: specifier: ^1.9.4 version: 1.9.4 + socket.io-client: + specifier: ^4.8.3 + version: 4.8.3 vue: specifier: ^3.5.6 version: 3.5.35(typescript@5.9.3) @@ -989,6 +992,9 @@ packages: resolution: {integrity: sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==} engines: {node: '>=18'} + '@socket.io/component-emitter@3.1.2': + resolution: {integrity: sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==} + '@stylistic/eslint-plugin@5.10.0': resolution: {integrity: sha512-nPK52ZHvot8Ju/0A4ucSX1dcPV2/1clx0kLcH5wDmrE4naKso7TUC/voUyU1O9OTKTrR6MYip6LP0ogEMQ9jPQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1587,6 +1593,13 @@ packages: resolution: {integrity: sha512-YGRs8knHhKHVShLkFET/rWAU8kmHbOV5LwN938RHI0pljAJ1Gf6SzXsSmRaEzcXTtOOmVqJ5+WtQPL5uigY50Q==} engines: {node: '>=14'} + engine.io-client@6.6.5: + resolution: {integrity: sha512-QCwxUDULPlXv8F6tqMMKx5dNkTe6OaBYRMPYeXKBlyOoKvAmE0ac6pW7fFhSscJ/5SI7666/U/B+MElbsrJlIg==} + + engine.io-parser@5.2.3: + resolution: {integrity: sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==} + engines: {node: '>=10.0.0'} + enhanced-resolve@5.23.0: resolution: {integrity: sha512-yJN/BOOLxcOW2aQgeif9mSnaUB8KtvmMMp56oA1kx1CRfBKbhZm2pJ+NBY+3eOboHxix8lfjWpHE0Ei5U8RbSA==} engines: {node: '>=10.13.0'} @@ -2516,6 +2529,14 @@ packages: sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + socket.io-client@4.8.3: + resolution: {integrity: sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==} + engines: {node: '>=10.0.0'} + + socket.io-parser@4.2.6: + resolution: {integrity: sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==} + engines: {node: '>=10.0.0'} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -2708,10 +2729,26 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + ws@8.20.1: + resolution: {integrity: sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + xml-name-validator@4.0.0: resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} engines: {node: '>=12'} + xmlhttprequest-ssl@2.1.2: + resolution: {integrity: sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==} + engines: {node: '>=0.4.0'} + yaml-eslint-parser@2.0.0: resolution: {integrity: sha512-h0uDm97wvT2bokfwwTmY6kJ1hp6YDFL0nRHwNKz8s/VD1FH/vvZjAKoMUE+un0eaYBSG7/c6h+lJTP+31tjgTw==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} @@ -3317,6 +3354,8 @@ snapshots: '@sindresorhus/base62@1.0.0': {} + '@socket.io/component-emitter@3.1.2': {} + '@stylistic/eslint-plugin@5.10.0(eslint@10.4.1(jiti@2.7.0))': dependencies: '@eslint-community/eslint-utils': 4.9.1(eslint@10.4.1(jiti@2.7.0)) @@ -3895,6 +3934,20 @@ snapshots: empathic@2.0.1: {} + engine.io-client@6.6.5: + dependencies: + '@socket.io/component-emitter': 3.1.2 + debug: 4.4.3 + engine.io-parser: 5.2.3 + ws: 8.20.1 + xmlhttprequest-ssl: 2.1.2 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + engine.io-parser@5.2.3: {} + enhanced-resolve@5.23.0: dependencies: graceful-fs: 4.2.11 @@ -5095,6 +5148,24 @@ snapshots: sisteransi@1.0.5: {} + socket.io-client@4.8.3: + dependencies: + '@socket.io/component-emitter': 3.1.2 + debug: 4.4.3 + engine.io-client: 6.6.5 + socket.io-parser: 4.2.6 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + socket.io-parser@4.2.6: + dependencies: + '@socket.io/component-emitter': 3.1.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + source-map-js@1.2.1: {} spdx-exceptions@2.5.0: {} @@ -5246,8 +5317,12 @@ snapshots: word-wrap@1.2.5: {} + ws@8.20.1: {} + xml-name-validator@4.0.0: {} + xmlhttprequest-ssl@2.1.2: {} + yaml-eslint-parser@2.0.0: dependencies: eslint-visitor-keys: 5.0.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2442848..f43443a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,6 +3,6 @@ shellEmulator: true trustPolicy: no-downgrade allowBuilds: - '@parcel/watcher': set this to true or false - esbuild: set this to true or false - vue-demi: set this to true or false + '@parcel/watcher': false + esbuild: false + vue-demi: false diff --git a/src/api/api.ts b/src/api/api.ts index 6c1be5a..56df8eb 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -169,9 +169,17 @@ export interface MatchDto { createdAt: string; } +export interface ChatDto { + id: string; + profile1Id: string; + profile2Id: string; + status: "active" | "closed"; +} + export interface CreateLikeResponseDto { like: LikeDto; match?: MatchDto | null; + chat?: ChatDto | null; } export interface CreateChatDto { @@ -181,13 +189,6 @@ export interface CreateChatDto { matchId: string; } -export interface ChatDto { - id: string; - profile1Id: string; - profile2Id: string; - status: "active" | "closed"; -} - export interface MessageDto { id: string; chatId: string; @@ -204,6 +205,17 @@ export interface SendMessageDto { mediaType?: "photo" | "voice" | "video"; } +export interface CloseChatDto { + /** cancel — отменить матч, report — пожаловаться */ + type: "cancel" | "report"; + /** Сообщение собеседнику при отмене матча */ + cancelMessage?: string; + /** Причина жалобы (preset) */ + reportReason?: string; + /** Дополнительное описание жалобы */ + reportDescription?: string; +} + export interface CreateDateDto { /** Your profile ID */ profileId: string; @@ -978,16 +990,22 @@ export class Api { * * @tags chat * @name ChatControllerCloseChat - * @summary Close a chat + * @summary Close a chat (cancel match or report) * @request DELETE:/api/v1/chats/{chatId} * @secure */ - chatControllerCloseChat: ({ chatId, ...query }: ChatControllerCloseChatParams, params: RequestParams = {}) => + chatControllerCloseChat: ( + { chatId, ...query }: ChatControllerCloseChatParams, + data: CloseChatDto, + params: RequestParams = {}, + ) => this.http.request({ path: `/api/v1/chats/${chatId}`, method: "DELETE", query: query, + body: data, secure: true, + type: ContentType.Json, format: "json", ...params, }), diff --git a/src/components/layout/SideNav.vue b/src/components/layout/SideNav.vue index 138caef..eac55d7 100644 --- a/src/components/layout/SideNav.vue +++ b/src/components/layout/SideNav.vue @@ -45,12 +45,12 @@