diff --git a/server/entities/activity.ts b/server/entities/activity.ts index 0e7ccc6f3..fa6318c18 100644 --- a/server/entities/activity.ts +++ b/server/entities/activity.ts @@ -50,6 +50,9 @@ export class Activity implements ActivityInterface { @CreateDateColumn() public createDate: Date; + @CreateDateColumn() + public publishDate: Date; + @UpdateDateColumn() public updateDate: Date; diff --git a/server/migrations/1717055850587-publishedAtActivityField.ts b/server/migrations/1717055850587-publishedAtActivityField.ts new file mode 100644 index 000000000..a827254c8 --- /dev/null +++ b/server/migrations/1717055850587-publishedAtActivityField.ts @@ -0,0 +1,20 @@ +import type { MigrationInterface, QueryRunner } from 'typeorm'; + +export class PublishedAtActivityField1717055850587 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const activityTable = await queryRunner.getTable('activity'); + if (!activityTable?.columns.find((col) => col.name === 'publishDate')) { + await queryRunner.query(`ALTER TABLE activity + ADD COLUMN publishDate TIMESTAMP`); + await queryRunner.query(`UPDATE activity SET publishDate = activity.createDate WHERE status = 0;`); + } + } + + public async down(queryRunner: QueryRunner): Promise { + const activityTable = await queryRunner.getTable('activity'); + if (activityTable?.columns.find((col) => col.name === 'publishDate')) { + await queryRunner.query(`ALTER TABLE activity + DROP COLUMN publishDate`); + } + } +} diff --git a/src/components/admin/NewAdminNavigation.tsx b/src/components/admin/NewAdminNavigation.tsx index d2946f9d9..2a363d1af 100644 --- a/src/components/admin/NewAdminNavigation.tsx +++ b/src/components/admin/NewAdminNavigation.tsx @@ -58,10 +58,20 @@ export const NewAdminNavigation = () => { const tabs: Tab[] = [ { path: '/admin/newportal/create', label: 'Créer', Icon: CreerIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR] }, - { path: '/admin/newportal/publish', label: 'Publier', Icon: PublierIcon, rights: [UserType.ADMIN] }, - { path: '/admin/newportal/manage', label: 'Gérer', Icon: GererIcon, rights: [UserType.ADMIN] }, - { path: '/admin/newportal/analyze', label: 'Analyser', Icon: AnalyserIcon, rights: [UserType.ADMIN, UserType.OBSERVATOR, UserType.MEDIATOR] }, - { path: '/admin/newportal/medialibrary', label: 'Médiathèque', Icon: MediathequeIcon, rights: [UserType.ADMIN, UserType.MEDIATOR] }, + { path: '/admin/newportal/publish', label: 'Publier', Icon: PublierIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, + { path: '/admin/newportal/manage', label: 'Gérer', Icon: GererIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, + { + path: '/admin/newportal/analyze', + label: 'Analyser', + Icon: AnalyserIcon, + rights: [UserType.SUPER_ADMIN, UserType.ADMIN, UserType.OBSERVATOR, UserType.MEDIATOR], + }, + { + path: '/admin/newportal/medialibrary', + label: 'Médiathèque', + Icon: MediathequeIcon, + rights: [UserType.SUPER_ADMIN, UserType.ADMIN, UserType.MEDIATOR], + }, ]; const onTabClick = (label: string) => {