Skip to content

Commit

Permalink
mig ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Ryo committed May 30, 2024
1 parent d22b461 commit 854f85a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
3 changes: 3 additions & 0 deletions server/entities/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export class Activity implements ActivityInterface<AnyData> {
@CreateDateColumn()
public createDate: Date;

@CreateDateColumn()
public publishDate: Date;

@UpdateDateColumn()
public updateDate: Date;

Expand Down
20 changes: 20 additions & 0 deletions server/migrations/1717055850587-publishedAtActivityField.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class PublishedAtActivityField1717055850587 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
const activityTable = await queryRunner.getTable('activity');
if (activityTable?.columns.find((col) => col.name === 'publishDate')) {
await queryRunner.query(`ALTER TABLE activity
DROP COLUMN publishDate`);
}
}
}
18 changes: 14 additions & 4 deletions src/components/admin/NewAdminNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 854f85a

Please sign in to comment.