Skip to content

Commit 07ea066

Browse files
authored
Merge pull request #383 from dataforgoodfr/379
Ajout rapports d'activité
2 parents c927bb9 + 594cac7 commit 07ea066

12 files changed

Lines changed: 330 additions & 23 deletions

File tree

backend/src/api/about/content-types/about/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
"type": "relation",
7575
"relation": "oneToMany",
7676
"target": "api::volunteer.volunteer"
77+
},
78+
"activity_reports": {
79+
"type": "component",
80+
"component": "file-list-with-dates.file-with-date",
81+
"repeatable": true
7782
}
7883
}
7984
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"collectionName": "components_file_list_with_dates_file_with_dates",
3+
"info": {
4+
"displayName": "File-with-date",
5+
"icon": "filePdf"
6+
},
7+
"options": {},
8+
"attributes": {
9+
"date": {
10+
"type": "date",
11+
"required": true
12+
},
13+
"file": {
14+
"type": "media",
15+
"multiple": false,
16+
"required": true,
17+
"allowedTypes": [
18+
"images",
19+
"files",
20+
"videos",
21+
"audios"
22+
]
23+
}
24+
},
25+
"config": {}
26+
}

backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json

Lines changed: 160 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"name": "Apache 2.0",
1515
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
1616
},
17-
"x-generation-date": "2025-10-01T08:09:20.342Z"
17+
"x-generation-date": "2026-02-27T11:12:11.224Z"
1818
},
1919
"x-strapi-config": {
2020
"plugins": [
@@ -12524,6 +12524,12 @@
1252412524
"example": "string or id"
1252512525
}
1252612526
},
12527+
"activity_reports": {
12528+
"type": "array",
12529+
"items": {
12530+
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
12531+
}
12532+
},
1252712533
"locale": {
1252812534
"type": "string"
1252912535
},
@@ -15083,6 +15089,12 @@
1508315089
}
1508415090
}
1508515091
},
15092+
"activity_reports": {
15093+
"type": "array",
15094+
"items": {
15095+
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
15096+
}
15097+
},
1508615098
"createdAt": {
1508715099
"type": "string",
1508815100
"format": "date-time"
@@ -15239,6 +15251,12 @@
1523915251
}
1524015252
}
1524115253
},
15254+
"activity_reports": {
15255+
"type": "array",
15256+
"items": {
15257+
"$ref": "#/components/schemas/FileListWithDatesFileWithDateComponent"
15258+
}
15259+
},
1524215260
"createdAt": {
1524315261
"type": "string",
1524415262
"format": "date-time"
@@ -15764,6 +15782,147 @@
1576415782
}
1576515783
}
1576615784
},
15785+
"FileListWithDatesFileWithDateComponent": {
15786+
"type": "object",
15787+
"properties": {
15788+
"id": {
15789+
"type": "number"
15790+
},
15791+
"date": {
15792+
"type": "string",
15793+
"format": "date"
15794+
},
15795+
"file": {
15796+
"type": "object",
15797+
"properties": {
15798+
"id": {
15799+
"type": "number"
15800+
},
15801+
"documentId": {
15802+
"type": "string"
15803+
},
15804+
"name": {
15805+
"type": "string"
15806+
},
15807+
"alternativeText": {
15808+
"type": "string"
15809+
},
15810+
"caption": {
15811+
"type": "string"
15812+
},
15813+
"width": {
15814+
"type": "integer"
15815+
},
15816+
"height": {
15817+
"type": "integer"
15818+
},
15819+
"formats": {},
15820+
"hash": {
15821+
"type": "string"
15822+
},
15823+
"ext": {
15824+
"type": "string"
15825+
},
15826+
"mime": {
15827+
"type": "string"
15828+
},
15829+
"size": {
15830+
"type": "number",
15831+
"format": "float"
15832+
},
15833+
"url": {
15834+
"type": "string"
15835+
},
15836+
"previewUrl": {
15837+
"type": "string"
15838+
},
15839+
"provider": {
15840+
"type": "string"
15841+
},
15842+
"provider_metadata": {},
15843+
"related": {
15844+
"type": "array",
15845+
"items": {
15846+
"type": "object",
15847+
"properties": {
15848+
"id": {
15849+
"type": "number"
15850+
},
15851+
"documentId": {
15852+
"type": "string"
15853+
}
15854+
}
15855+
}
15856+
},
15857+
"folder": {
15858+
"type": "object",
15859+
"properties": {
15860+
"id": {
15861+
"type": "number"
15862+
},
15863+
"documentId": {
15864+
"type": "string"
15865+
}
15866+
}
15867+
},
15868+
"folderPath": {
15869+
"type": "string"
15870+
},
15871+
"createdAt": {
15872+
"type": "string",
15873+
"format": "date-time"
15874+
},
15875+
"updatedAt": {
15876+
"type": "string",
15877+
"format": "date-time"
15878+
},
15879+
"publishedAt": {
15880+
"type": "string",
15881+
"format": "date-time"
15882+
},
15883+
"createdBy": {
15884+
"type": "object",
15885+
"properties": {
15886+
"id": {
15887+
"type": "number"
15888+
},
15889+
"documentId": {
15890+
"type": "string"
15891+
}
15892+
}
15893+
},
15894+
"updatedBy": {
15895+
"type": "object",
15896+
"properties": {
15897+
"id": {
15898+
"type": "number"
15899+
},
15900+
"documentId": {
15901+
"type": "string"
15902+
}
15903+
}
15904+
},
15905+
"locale": {
15906+
"type": "string"
15907+
},
15908+
"localizations": {
15909+
"type": "array",
15910+
"items": {
15911+
"type": "object",
15912+
"properties": {
15913+
"id": {
15914+
"type": "number"
15915+
},
15916+
"documentId": {
15917+
"type": "string"
15918+
}
15919+
}
15920+
}
15921+
}
15922+
}
15923+
}
15924+
}
15925+
},
1576715926
"KpiKpiComponent": {
1576815927
"type": "object",
1576915928
"properties": {

backend/types/generated/components.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ export interface EditoEdito extends Struct.ComponentSchema {
4040
};
4141
}
4242

43+
export interface FileListWithDatesFileWithDate extends Struct.ComponentSchema {
44+
collectionName: 'components_file_list_with_dates_file_with_dates';
45+
info: {
46+
displayName: 'File-with-date';
47+
icon: 'filePdf';
48+
};
49+
attributes: {
50+
date: Schema.Attribute.Date & Schema.Attribute.Required;
51+
file: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'> &
52+
Schema.Attribute.Required;
53+
};
54+
}
55+
4356
export interface GoalGoal extends Struct.ComponentSchema {
4457
collectionName: 'components_goal_goals';
4558
info: {
@@ -157,6 +170,7 @@ declare module '@strapi/strapi' {
157170
'call-to-action.call-to-action': CallToActionCallToAction;
158171
'call-to-action.call-to-action-with-image': CallToActionCallToActionWithImage;
159172
'edito.edito': EditoEdito;
173+
'file-list-with-dates.file-with-date': FileListWithDatesFileWithDate;
160174
'goal.goal': GoalGoal;
161175
'hero.hero': HeroHero;
162176
'information.information-block': InformationInformationBlock;

backend/types/generated/contentTypes.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ export interface ApiAboutAbout extends Struct.SingleTypeSchema {
385385
draftAndPublish: true;
386386
};
387387
attributes: {
388+
activity_reports: Schema.Attribute.Component<
389+
'file-list-with-dates.file-with-date',
390+
true
391+
>;
388392
board_of_directors: Schema.Attribute.Relation<
389393
'oneToMany',
390394
'api::volunteer.volunteer'

frontend/src/app/[locale]/about/about.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
PartnersBlock,
1010
Title,
1111
TestimoniesCarousel,
12+
CtaList,
1213
} from '@/components';
1314
import { IMembers } from '@/lib/types';
1415
import { AboutPageData } from './page';
@@ -84,6 +85,16 @@ function transformMembers({
8485
];
8586
}
8687

88+
function transformActivityReports(
89+
reports: NonNullable<AboutPageData['activity_reports']>
90+
) {
91+
return reports.map(report => ({
92+
id: report.documentId || report.id,
93+
text: new Date(report.date).getFullYear().toString(),
94+
link: report.file?.url || '#',
95+
}));
96+
}
97+
8798
type AboutProps = {
8899
data: AboutPageData;
89100
};
@@ -100,6 +111,9 @@ export default function AboutPage({ data }: AboutProps) {
100111
strategic_committee: data.strategic_committee,
101112
division_managers: data.division_managers,
102113
});
114+
const activityReports = data.activity_reports
115+
? transformActivityReports(data.activity_reports)
116+
: [];
103117

104118
return (
105119
<>
@@ -198,6 +212,15 @@ export default function AboutPage({ data }: AboutProps) {
198212
categories={members}
199213
className="my-lg"
200214
/>
215+
216+
{activityReports.length > 0 && (
217+
<div className="container my-lg">
218+
<Title className="mb-md" level={2} hasSeparator variant="medium">
219+
Rapports d'activités
220+
</Title>
221+
<CtaList items={activityReports} />
222+
</div>
223+
)}
201224
</>
202225
);
203226
}

frontend/src/app/[locale]/about/page.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
2-
import AboutPage from './about';
31
import client from '@/lib/strapi-client';
42
import { generateMetadataFromSeo } from '@/lib/utils';
3+
import AboutPage from './about';
54

65
export async function generateMetadata({
76
params: { locale },
@@ -49,15 +48,22 @@ async function fetchAboutPageData() {
4948
scientific_committee: {
5049
populate: "*"
5150
},
52-
strategic_committee: {
53-
populate: "*"
54-
},
55-
division_managers: {
56-
populate: "*"
57-
},
58-
seo_meta: {
59-
populate: "*"
60-
}
51+
strategic_committee: {
52+
populate: "*"
53+
},
54+
division_managers: {
55+
populate: "*"
56+
},
57+
seo_meta: {
58+
populate: "*"
59+
},
60+
activity_reports: {
61+
populate: {
62+
file: {
63+
populate: '*'
64+
}
65+
}
66+
}
6167
}
6268
}
6369
}
@@ -68,9 +74,10 @@ export type AboutPageData = NonNullable<NonNullable<Awaited<ReturnType<typeof fe
6874

6975

7076
export default async function Page() {
71-
const { data } = await fetchAboutPageData();
77+
const { data, error } = await fetchAboutPageData();
7278

73-
if (!data?.data) {
79+
if (!data?.data) {
80+
console.error(error);
7481
return null;
7582
}
7683

0 commit comments

Comments
 (0)