Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Push filtering, sorting and pagination into the database layer

未关闭
#47 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
领域
backend, database

调研方向

先阅读 LearnStack.Core/Services/LearningResourceService.cs:12-21 和 :74-96,然后检查 Resources.razor:636-643 和 Pulse.razor.cs:60。在引入查询/筛选和分页结果设计之前,先追踪当前内存中操作的工作方式。完成标准是:每个资源列表页面执行一次查询、执行一次带索引的重复 URL 查找,并且 Pulse 聚合不对整个库进行实体化。

由索引模型根据 Issue 内容生成。

描述

enhancement

Tier 2 — scale

Problem

GetAllAsync(userId) loads a user's entire library into memory (thumbnails included); the component then filters, sorts and pages it client-side. UrlExistsAsync loads every URL a user owns just to compare one. Pulse loads everything to compute aggregates. This is fine at 50 resources and collapses at 5,000.

Evidence
  • LearnStack.Core/Services/LearningResourceService.cs:12-21 — GetAllAsync
  • LearnStack.Core/Services/LearningResourceService.cs:74-96 — UrlExistsAsync materializes all URLs
  • LearnStack/Components/Pages/Resources.razor:636-643 — in-memory paging
  • LearnStack/Components/Pages/Pulse.razor.cs:60 — loads all resources for aggregates
Proposed fix
  1. Introduce a query/filter object and return a paged result (Items, TotalCount) from the service.
  2. Apply search, status/type/priority filters, sorting and Skip/Take in IQueryable.
  3. Add a persisted NormalizedUrl column with a unique index per user, and replace UrlExistsAsync with a single indexed lookup.
  4. Compute Pulse aggregates with GroupBy in SQL rather than in memory.
Acceptance criteria
  • Resource list issues one query per page regardless of library size
  • Duplicate-URL check is a single indexed query
  • Pulse does not materialize the full library
主要语言
HTML
星标
10
派生
0
平均合并
2 小时 35 分钟
30 天内合并 PR
21

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kasuken/LearnStack 的其他 Issue

查看 kasuken/LearnStack 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。