feat: invites
CI / CD / Unit tests (push) Successful in 38s
CI / CD / Build & push Helm chart (push) Successful in 11s
CI / CD / Build & push frontend-static (push) Successful in 31s
CI / CD / Build & push frontend (nginx) (push) Successful in 29s
CI / CD / Build & push backend (push) Successful in 1m49s
CI / CD / Unit tests (push) Successful in 38s
CI / CD / Build & push Helm chart (push) Successful in 11s
CI / CD / Build & push frontend-static (push) Successful in 31s
CI / CD / Build & push frontend (nginx) (push) Successful in 29s
CI / CD / Build & push backend (push) Successful in 1m49s
This commit is contained in:
@@ -66,6 +66,9 @@ export const api = {
|
|||||||
joinCollection: (id) => request('POST', `/collections/${id}/join`),
|
joinCollection: (id) => request('POST', `/collections/${id}/join`),
|
||||||
regenerateShareLink: (id) => request('POST', `/collections/${id}/share-link/regenerate`),
|
regenerateShareLink: (id) => request('POST', `/collections/${id}/share-link/regenerate`),
|
||||||
|
|
||||||
|
// ── Bot ───────────────────────────────────────────────────────────────────
|
||||||
|
getBotInfo: () => request('GET', '/bot/info'),
|
||||||
|
|
||||||
// ── Invites ───────────────────────────────────────────────────────────────
|
// ── Invites ───────────────────────────────────────────────────────────────
|
||||||
getInvites: (collectionId) => request('GET', `/collections/${collectionId}/invites`),
|
getInvites: (collectionId) => request('GET', `/collections/${collectionId}/invites`),
|
||||||
createInvite: (collectionId, role, expiresAt) =>
|
createInvite: (collectionId, role, expiresAt) =>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { Pencil, Trash2, Star, Check, X, EyeOff, Copy } from 'lucide-svelte'
|
import { Pencil, Trash2, Star, Check, X, EyeOff, Copy, Link, Plus, UserCheck } from 'lucide-svelte'
|
||||||
import { api } from '../lib/api.js'
|
import { api } from '../lib/api.js'
|
||||||
import { showAlert } from '../lib/telegram.js'
|
import { showAlert } from '../lib/telegram.js'
|
||||||
|
|
||||||
|
let botUsername = $state('')
|
||||||
|
|
||||||
let collections = $state([])
|
let collections = $state([])
|
||||||
let loading = $state(true)
|
let loading = $state(true)
|
||||||
let error = $state(null)
|
let error = $state(null)
|
||||||
@@ -23,9 +25,35 @@
|
|||||||
// Клонирование: id коллекции, которая клонируется прямо сейчас
|
// Клонирование: id коллекции, которая клонируется прямо сейчас
|
||||||
let cloning = $state(null)
|
let cloning = $state(null)
|
||||||
|
|
||||||
|
// Управление инвайтами: id раскрытой коллекции
|
||||||
|
let invitesPanelId = $state(null)
|
||||||
|
// { [collectionId]: CollectionInviteDto[] }
|
||||||
|
let invitesByCol = $state({})
|
||||||
|
let invitesLoading = $state(false)
|
||||||
|
// Форма создания инвайта: { role: 0|1, expiresAt: string|null }
|
||||||
|
let newInvite = $state({ role: 0, expiresAt: '' })
|
||||||
|
let creatingInvite = $state(false)
|
||||||
|
|
||||||
let deleteTarget = $derived(collections.find(c => c.id === confirmDelete))
|
let deleteTarget = $derived(collections.find(c => c.id === confirmDelete))
|
||||||
let inboxTarget = $derived(collections.find(c => c.id === confirmInbox))
|
let inboxTarget = $derived(collections.find(c => c.id === confirmInbox))
|
||||||
|
|
||||||
|
// CollectionRole: Viewer=0, Manager=1, Owner=2
|
||||||
|
const ROLE_OWNER = 2
|
||||||
|
|
||||||
|
function inviteLink(token) {
|
||||||
|
if (!botUsername) return null
|
||||||
|
return `https://t.me/${botUsername}?start=inv_${token}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function roleLabel(role) {
|
||||||
|
return role === 0 ? 'Читатель' : 'Менеджер'
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatExpiry(expiresAt) {
|
||||||
|
if (!expiresAt) return null
|
||||||
|
return new Date(expiresAt).toLocaleDateString('ru-RU', { day: 'numeric', month: 'short' })
|
||||||
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
loading = true; error = null
|
loading = true; error = null
|
||||||
try { collections = await api.getCollections() }
|
try { collections = await api.getCollections() }
|
||||||
@@ -50,6 +78,7 @@
|
|||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
visibility: 0,
|
visibility: 0,
|
||||||
shareToken: null,
|
shareToken: null,
|
||||||
|
myRole: ROLE_OWNER,
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
}]
|
}]
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -129,7 +158,87 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(load)
|
// ── Инвайты ────────────────────────────────────────────────────────────────
|
||||||
|
async function toggleInvitesPanel(colId) {
|
||||||
|
if (invitesPanelId === colId) {
|
||||||
|
invitesPanelId = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
invitesPanelId = colId
|
||||||
|
newInvite = { role: 0, expiresAt: '' }
|
||||||
|
if (invitesByCol[colId]) return // уже загружены
|
||||||
|
|
||||||
|
invitesLoading = true
|
||||||
|
try {
|
||||||
|
invitesByCol = { ...invitesByCol, [colId]: await api.getInvites(colId) }
|
||||||
|
} catch (e) {
|
||||||
|
showAlert(e.message)
|
||||||
|
invitesPanelId = null
|
||||||
|
} finally {
|
||||||
|
invitesLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createInvite(colId) {
|
||||||
|
creatingInvite = true
|
||||||
|
try {
|
||||||
|
const expiresAt = newInvite.expiresAt
|
||||||
|
? new Date(newInvite.expiresAt).toISOString()
|
||||||
|
: null
|
||||||
|
const { token } = await api.createInvite(colId, newInvite.role, expiresAt)
|
||||||
|
const created = {
|
||||||
|
id: crypto.randomUUID(), // placeholder до перезагрузки
|
||||||
|
token,
|
||||||
|
role: newInvite.role,
|
||||||
|
isRevoked: false,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
revokedAt: null,
|
||||||
|
expiresAt: expiresAt,
|
||||||
|
}
|
||||||
|
invitesByCol = {
|
||||||
|
...invitesByCol,
|
||||||
|
[colId]: [created, ...(invitesByCol[colId] ?? [])],
|
||||||
|
}
|
||||||
|
newInvite = { role: 0, expiresAt: '' }
|
||||||
|
} catch (e) {
|
||||||
|
showAlert(e.message)
|
||||||
|
} finally {
|
||||||
|
creatingInvite = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function revokeInvite(colId, inviteId) {
|
||||||
|
try {
|
||||||
|
await api.revokeInvite(colId, inviteId)
|
||||||
|
invitesByCol = {
|
||||||
|
...invitesByCol,
|
||||||
|
[colId]: invitesByCol[colId].filter(i => i.id !== inviteId),
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
showAlert(e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyToClipboard(text) {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
} catch {
|
||||||
|
// fallback для старых WebView
|
||||||
|
const el = document.createElement('textarea')
|
||||||
|
el.value = text
|
||||||
|
document.body.appendChild(el)
|
||||||
|
el.select()
|
||||||
|
document.execCommand('copy')
|
||||||
|
document.body.removeChild(el)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
load()
|
||||||
|
api.getBotInfo()
|
||||||
|
.then(r => { botUsername = r?.username ?? '' })
|
||||||
|
.catch(() => {})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
@@ -208,6 +317,16 @@
|
|||||||
>
|
>
|
||||||
<Copy size={16}/>
|
<Copy size={16}/>
|
||||||
</button>
|
</button>
|
||||||
|
{#if col.myRole === ROLE_OWNER}
|
||||||
|
<button
|
||||||
|
class="icon-btn invite"
|
||||||
|
class:invite--on={invitesPanelId === col.id}
|
||||||
|
onclick={() => toggleInvitesPanel(col.id)}
|
||||||
|
title="Управление приглашениями"
|
||||||
|
>
|
||||||
|
<Link size={16}/>
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
{#if !col.isInbox}
|
{#if !col.isInbox}
|
||||||
<button class="icon-btn" onclick={() => startEdit(col)} title="Переименовать">
|
<button class="icon-btn" onclick={() => startEdit(col)} title="Переименовать">
|
||||||
<Pencil size={16}/>
|
<Pencil size={16}/>
|
||||||
@@ -223,6 +342,91 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- Панель инвайтов -->
|
||||||
|
{#if invitesPanelId === col.id}
|
||||||
|
<li class="invites-panel">
|
||||||
|
<div class="invites-header">
|
||||||
|
<UserCheck size={14}/> Приглашения
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if invitesLoading}
|
||||||
|
<div class="invites-loading">Загрузка…</div>
|
||||||
|
{:else}
|
||||||
|
<!-- Список активных инвайтов -->
|
||||||
|
{#if invitesByCol[col.id]?.length > 0}
|
||||||
|
<ul class="invites-list">
|
||||||
|
{#each invitesByCol[col.id] as inv (inv.id)}
|
||||||
|
<li class="invite-item">
|
||||||
|
<span class="invite-role-badge">{roleLabel(inv.role)}</span>
|
||||||
|
{#if inviteLink(inv.token)}
|
||||||
|
<button
|
||||||
|
class="invite-link-btn"
|
||||||
|
onclick={() => copyToClipboard(inviteLink(inv.token))}
|
||||||
|
title="Скопировать ссылку"
|
||||||
|
>
|
||||||
|
<Copy size={12}/> Копировать
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
class="invite-link-btn"
|
||||||
|
onclick={() => copyToClipboard(inv.token)}
|
||||||
|
title="Скопировать токен"
|
||||||
|
>
|
||||||
|
<Copy size={12}/> Токен
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
{#if inv.expiresAt}
|
||||||
|
<span class="invite-expiry">до {formatExpiry(inv.expiresAt)}</span>
|
||||||
|
{/if}
|
||||||
|
<button
|
||||||
|
class="icon-btn del invite-revoke"
|
||||||
|
onclick={() => revokeInvite(col.id, inv.id)}
|
||||||
|
title="Отозвать"
|
||||||
|
>
|
||||||
|
<X size={14}/>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{:else}
|
||||||
|
<div class="invites-empty">Нет активных приглашений</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Форма создания нового инвайта -->
|
||||||
|
<div class="invite-create">
|
||||||
|
<div class="invite-create-row">
|
||||||
|
<div class="role-toggle">
|
||||||
|
<button
|
||||||
|
class="role-btn"
|
||||||
|
class:role-btn--active={newInvite.role === 0}
|
||||||
|
onclick={() => newInvite = { ...newInvite, role: 0 }}
|
||||||
|
>Читатель</button>
|
||||||
|
<button
|
||||||
|
class="role-btn"
|
||||||
|
class:role-btn--active={newInvite.role === 1}
|
||||||
|
onclick={() => newInvite = { ...newInvite, role: 1 }}
|
||||||
|
>Менеджер</button>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
class="expiry-input"
|
||||||
|
type="date"
|
||||||
|
bind:value={newInvite.expiresAt}
|
||||||
|
title="Срок действия (необязательно)"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="invite-add-btn"
|
||||||
|
onclick={() => createInvite(col.id)}
|
||||||
|
disabled={creatingInvite}
|
||||||
|
title="Создать ссылку-приглашение"
|
||||||
|
>
|
||||||
|
<Plus size={14}/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!-- Подтверждение удаления -->
|
<!-- Подтверждение удаления -->
|
||||||
{#if confirmDelete === col.id && deleteTarget}
|
{#if confirmDelete === col.id && deleteTarget}
|
||||||
<li class="confirm-panel">
|
<li class="confirm-panel">
|
||||||
@@ -335,6 +539,9 @@
|
|||||||
.icon-btn.nsfw { color: var(--tg-hint, #999); }
|
.icon-btn.nsfw { color: var(--tg-hint, #999); }
|
||||||
.icon-btn.nsfw:hover { color: #e53935; background: var(--tg-secondary-bg, #e8e8e8); }
|
.icon-btn.nsfw:hover { color: #e53935; background: var(--tg-secondary-bg, #e8e8e8); }
|
||||||
.icon-btn.nsfw--on { color: #e53935; }
|
.icon-btn.nsfw--on { color: #e53935; }
|
||||||
|
.icon-btn.invite { color: var(--tg-hint, #999); }
|
||||||
|
.icon-btn.invite:hover { color: var(--tg-button, #2196f3); }
|
||||||
|
.icon-btn.invite--on { color: var(--tg-button, #2196f3); }
|
||||||
|
|
||||||
/* Подтверждение */
|
/* Подтверждение */
|
||||||
.confirm-panel {
|
.confirm-panel {
|
||||||
@@ -353,4 +560,97 @@
|
|||||||
.btn-primary { background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff); }
|
.btn-primary { background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff); }
|
||||||
.btn-ghost { background: none; color: var(--tg-hint, #888); }
|
.btn-ghost { background: none; color: var(--tg-hint, #888); }
|
||||||
.btn-ghost:hover { background: var(--tg-secondary-bg, #e8e8e8); }
|
.btn-ghost:hover { background: var(--tg-secondary-bg, #e8e8e8); }
|
||||||
|
|
||||||
|
/* ── Панель инвайтов ─────────────────────────────────────────────────────── */
|
||||||
|
.invites-panel {
|
||||||
|
background: var(--tg-secondary-bg, #f5f5f5);
|
||||||
|
border-radius: 10px; padding: 10px 12px;
|
||||||
|
border-left: 3px solid var(--tg-button, #2196f3);
|
||||||
|
display: flex; flex-direction: column; gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invites-header {
|
||||||
|
display: flex; align-items: center; gap: 6px;
|
||||||
|
font-size: 12px; font-weight: 600; color: var(--tg-hint, #888);
|
||||||
|
text-transform: uppercase; letter-spacing: .05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invites-loading { font-size: 13px; color: var(--tg-hint, #888); }
|
||||||
|
.invites-empty { font-size: 13px; color: var(--tg-hint, #888); text-align: center; padding: 4px 0; }
|
||||||
|
|
||||||
|
.invites-list {
|
||||||
|
list-style: none; margin: 0; padding: 0;
|
||||||
|
display: flex; flex-direction: column; gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-item {
|
||||||
|
display: flex; align-items: center; gap: 6px;
|
||||||
|
background: var(--tg-bg, #fff);
|
||||||
|
border-radius: 8px; padding: 6px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-role-badge {
|
||||||
|
font-size: 11px; font-weight: 600;
|
||||||
|
background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff);
|
||||||
|
border-radius: 4px; padding: 1px 6px;
|
||||||
|
white-space: nowrap; flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-link-btn {
|
||||||
|
display: flex; align-items: center; gap: 4px;
|
||||||
|
padding: 3px 8px; border-radius: 6px; border: none;
|
||||||
|
background: var(--tg-secondary-bg, #f0f0f0);
|
||||||
|
color: var(--tg-text, #000); font-size: 12px; cursor: pointer;
|
||||||
|
white-space: nowrap; flex-shrink: 0;
|
||||||
|
transition: background .12s;
|
||||||
|
}
|
||||||
|
.invite-link-btn:hover { background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff); }
|
||||||
|
|
||||||
|
.invite-expiry {
|
||||||
|
font-size: 11px; color: var(--tg-hint, #888);
|
||||||
|
white-space: nowrap; flex-shrink: 0; margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-revoke {
|
||||||
|
width: 26px; height: 26px; flex-shrink: 0;
|
||||||
|
color: var(--tg-hint, #999);
|
||||||
|
}
|
||||||
|
.invite-revoke:hover { color: #e53935; }
|
||||||
|
|
||||||
|
/* Форма создания инвайта */
|
||||||
|
.invite-create { margin-top: 2px; }
|
||||||
|
.invite-create-row {
|
||||||
|
display: flex; gap: 6px; align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-toggle {
|
||||||
|
display: flex; border-radius: 8px; overflow: hidden;
|
||||||
|
border: 1px solid var(--tg-hint, #ccc);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.role-btn {
|
||||||
|
padding: 5px 10px; border: none; font-size: 12px; font-weight: 500;
|
||||||
|
background: none; color: var(--tg-hint, #888); cursor: pointer;
|
||||||
|
transition: background .12s, color .12s;
|
||||||
|
}
|
||||||
|
.role-btn:first-child { border-right: 1px solid var(--tg-hint, #ccc); }
|
||||||
|
.role-btn--active {
|
||||||
|
background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.expiry-input {
|
||||||
|
flex: 1; min-width: 0; padding: 5px 8px; border-radius: 8px;
|
||||||
|
border: 1px solid var(--tg-hint, #ccc);
|
||||||
|
background: var(--tg-bg, #fff); color: var(--tg-text, #000);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-add-btn {
|
||||||
|
display: flex; align-items: center; justify-content: center;
|
||||||
|
width: 32px; height: 32px; border-radius: 8px; border: none;
|
||||||
|
background: var(--tg-button, #2196f3); color: var(--tg-btn-text, #fff);
|
||||||
|
cursor: pointer; flex-shrink: 0;
|
||||||
|
transition: opacity .12s;
|
||||||
|
}
|
||||||
|
.invite-add-btn:disabled { opacity: .4; cursor: default; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using MemeVault.Api.Services;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace MemeVault.Api.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/bot")]
|
||||||
|
public sealed class BotController(BotInfoService botInfo) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает публичный username бота.
|
||||||
|
/// Не требует авторизации — username бота публичен.
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet("info")]
|
||||||
|
public async Task<IActionResult> GetInfo(CancellationToken ct)
|
||||||
|
{
|
||||||
|
var username = await botInfo.GetBotUsernameAsync();
|
||||||
|
return Ok(new { username });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using MemeVault.Api.Middleware;
|
using MemeVault.Api.Middleware;
|
||||||
using MemeVault.Api.Auth;
|
using MemeVault.Api.Auth;
|
||||||
|
using MemeVault.Api.Services;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MemeVault.Api.Options;
|
using MemeVault.Api.Options;
|
||||||
using MemeVault.Infrastructure;
|
using MemeVault.Infrastructure;
|
||||||
@@ -29,6 +30,7 @@ builder.Services.Configure<JwtOptions>(
|
|||||||
builder.Services.AddSingleton<TelegramInitDataValidator>();
|
builder.Services.AddSingleton<TelegramInitDataValidator>();
|
||||||
builder.Services.AddSingleton<InlineAuthValidator>();
|
builder.Services.AddSingleton<InlineAuthValidator>();
|
||||||
builder.Services.AddSingleton<JwtTokenService>();
|
builder.Services.AddSingleton<JwtTokenService>();
|
||||||
|
builder.Services.AddSingleton<BotInfoService>();
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
builder.Services.AddScoped<CurrentUser>();
|
builder.Services.AddScoped<CurrentUser>();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using Telegram.Bot;
|
||||||
|
|
||||||
|
namespace MemeVault.Api.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Кэширует username бота на весь lifetime процесса.
|
||||||
|
/// GetMeAsync вызывается ровно один раз при первом обращении.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BotInfoService
|
||||||
|
{
|
||||||
|
private readonly Lazy<Task<string>> _username;
|
||||||
|
|
||||||
|
public BotInfoService(ITelegramBotClient botClient)
|
||||||
|
{
|
||||||
|
_username = new Lazy<Task<string>>(
|
||||||
|
() => FetchAsync(botClient),
|
||||||
|
LazyThreadSafetyMode.ExecutionAndPublication);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<string> FetchAsync(ITelegramBotClient botClient)
|
||||||
|
{
|
||||||
|
var me = await botClient.GetMe();
|
||||||
|
return me.Username ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<string> GetBotUsernameAsync() => _username.Value;
|
||||||
|
}
|
||||||
@@ -15,5 +15,6 @@ public sealed record CollectionDto(
|
|||||||
bool IsNsfw,
|
bool IsNsfw,
|
||||||
string? ShareToken,
|
string? ShareToken,
|
||||||
int ItemCount,
|
int ItemCount,
|
||||||
DateTimeOffset CreatedAt
|
DateTimeOffset CreatedAt,
|
||||||
|
CollectionRole MyRole
|
||||||
);
|
);
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,5 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
|
using MemeVault.Domain.Enums;
|
||||||
using MemeVault.Domain.Repositories;
|
using MemeVault.Domain.Repositories;
|
||||||
|
|
||||||
namespace MemeVault.Application.Queries.GetUserCollections;
|
namespace MemeVault.Application.Queries.GetUserCollections;
|
||||||
@@ -35,7 +36,8 @@ public sealed class GetUserCollectionsQueryHandler(
|
|||||||
c.IsNsfw,
|
c.IsNsfw,
|
||||||
c.ShareToken,
|
c.ShareToken,
|
||||||
countByCollection.GetValueOrDefault(c.Id, 0),
|
countByCollection.GetValueOrDefault(c.Id, 0),
|
||||||
c.CreatedAt
|
c.CreatedAt,
|
||||||
|
c.GetRole(request.OwnerTelegramId) ?? CollectionRole.Viewer
|
||||||
)).ToList();
|
)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user