Skip to content

Commit a52d301

Browse files
authored
Merge pull request #119 from Iamlovingit/codex/bugfix
fix: paginate user management list
2 parents e99c49f + a3bbedb commit a52d301

4 files changed

Lines changed: 192 additions & 106 deletions

File tree

backend/internal/repository/user_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (r *userRepository) Delete(id int) error {
100100
// List returns a list of users with pagination
101101
func (r *userRepository) List(offset, limit int) ([]models.User, error) {
102102
var users []models.User
103-
err := r.sess.Collection("users").Find().Offset(offset).Limit(limit).All(&users)
103+
err := r.sess.Collection("users").Find().OrderBy("id").Offset(offset).Limit(limit).All(&users)
104104
if err != nil {
105105
return nil, fmt.Errorf("failed to list users: %w", err)
106106
}

frontend/src/lib/i18n.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,8 @@ export const translations: Record<Locale, TranslationTree> = {
15091509
selectCsv: "Please select a CSV file to import",
15101510
importFailed: "Failed to import users",
15111511
importUsers: "Import Users",
1512+
showingUsers: "Showing {from}-{to} of {total} users",
1513+
noUsers: "No users found",
15121514
importCompleted: "Import completed: {created} created, {failed} failed",
15131515
expectedColumns: "Expected columns:",
15141516
lineError: "Line {line}{username}",
@@ -2703,6 +2705,8 @@ export const translations: Record<Locale, TranslationTree> = {
27032705
selectCsv: "请先选择要导入的 CSV 文件",
27042706
importFailed: "导入用户失败",
27052707
importUsers: "导入用户",
2708+
showingUsers: "显示第 {from}-{to} 个用户,共 {total} 个",
2709+
noUsers: "暂无用户",
27062710
importCompleted: "导入完成:成功创建 {created} 个,失败 {failed} 个",
27072711
expectedColumns: "期望列:",
27082712
lineError: "第 {line} 行{username}",
@@ -3874,6 +3878,8 @@ export const translations: Record<Locale, TranslationTree> = {
38743878
selectCsv: "インポートする CSV ファイルを選択してください",
38753879
importFailed: "ユーザーのインポートに失敗しました",
38763880
importUsers: "ユーザーをインポート",
3881+
showingUsers: "{total} 人中 {from}-{to} 人のユーザーを表示",
3882+
noUsers: "ユーザーが見つかりません",
38773883
importCompleted: "インポート完了: 作成 {created} 件、失敗 {failed} 件",
38783884
expectedColumns: "想定列:",
38793885
lineError: "行 {line}{username}",
@@ -5096,6 +5102,8 @@ export const translations: Record<Locale, TranslationTree> = {
50965102
selectCsv: "가져올 CSV 파일을 선택하세요",
50975103
importFailed: "사용자 가져오기에 실패했습니다",
50985104
importUsers: "사용자 가져오기",
5105+
showingUsers: "총 {total}명 중 {from}-{to}명 사용자 표시",
5106+
noUsers: "사용자를 찾을 수 없습니다",
50995107
importCompleted: "가져오기 완료: 생성 {created}명, 실패 {failed}명",
51005108
expectedColumns: "필수 열:",
51015109
lineError: "{line}행{username}",
@@ -6317,6 +6325,8 @@ export const translations: Record<Locale, TranslationTree> = {
63176325
selectCsv: "Bitte wählen Sie eine CSV-Datei zum Importieren aus",
63186326
importFailed: "Benutzer konnten nicht importiert werden",
63196327
importUsers: "Benutzer importieren",
6328+
showingUsers: "Zeige Benutzer {from}-{to} von {total}",
6329+
noUsers: "Keine Benutzer gefunden",
63206330
importCompleted:
63216331
"Import abgeschlossen: {created} erstellt, {failed} fehlgeschlagen",
63226332
expectedColumns: "Erwartete Spalten:",

0 commit comments

Comments
 (0)