feat: add archived documents section and filtering options to club archive view
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 52s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 52s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Op } from 'sequelize';
|
||||
import sequelize from '../database.js';
|
||||
import { ClubPaymentClaim, ClubRequest, ClubTask, Member } from '../models/index.js';
|
||||
import { ClubDocument, ClubPaymentClaim, ClubRequest, ClubTask, Member } from '../models/index.js';
|
||||
import { hasClubPaymentClaimPaidAmountCentsColumn } from './clubPaymentClaimCompatibility.js';
|
||||
|
||||
const DEFAULT_LIMIT = 50;
|
||||
@@ -90,6 +90,16 @@ class ClubArchiveService {
|
||||
)
|
||||
: [];
|
||||
|
||||
const archivedDocuments = await loadOptionalTableData(
|
||||
availableTables,
|
||||
'club_documents',
|
||||
() => ClubDocument.findAll({
|
||||
where: { clubId, status: { [Op.in]: ['archived', 'obsolete'] } },
|
||||
order: [['archivedAt', 'DESC'], ['updatedAt', 'DESC']],
|
||||
limit: DEFAULT_LIMIT,
|
||||
})
|
||||
);
|
||||
|
||||
const inactiveMembers = members
|
||||
.filter((member) => !member.active)
|
||||
.slice(0, DEFAULT_LIMIT)
|
||||
@@ -110,6 +120,7 @@ class ClubArchiveService {
|
||||
archivedRequests: archivedRequests.length,
|
||||
archivedTasks: archivedTasks.length,
|
||||
archivedClaims: archivedClaims.length,
|
||||
archivedDocuments: archivedDocuments.length,
|
||||
},
|
||||
inactiveMembers,
|
||||
archivedRequests: archivedRequests.map((entry) => ({
|
||||
@@ -148,6 +159,14 @@ class ClubArchiveService {
|
||||
updatedAt: entry.updatedAt || null,
|
||||
};
|
||||
}),
|
||||
archivedDocuments: archivedDocuments.map((entry) => ({
|
||||
id: entry.id,
|
||||
title: entry.title || 'Dokument',
|
||||
documentType: entry.documentType || 'other',
|
||||
status: entry.status,
|
||||
archivedAt: entry.archivedAt || null,
|
||||
updatedAt: entry.updatedAt || null,
|
||||
})),
|
||||
notes: [
|
||||
'Das Vereinsarchiv zeigt inaktive Mitglieder sowie archivierte oder abgeschlossene Vereinsvorgänge.',
|
||||
'Ein zentrales Dokumentenarchiv wird ergänzt, sobald Dokumente und Rechnungen produktiv archiviert werden.',
|
||||
|
||||
Reference in New Issue
Block a user