Simone 9b5e69d822
feat(content-releases): Release Details page (#19026)
* first implementation details page

* refactor code based on comments received

* move the countDays function inside the ReleaseDetails page

* fix unit tests for the Details page

* add padding bottom heading

* fix type errors

* integrate new fields to the Details page

* fix types

* change the way we handle the timepassed since release creation

* fix unit test

* fix review comments

* unit test control table content

* fix review comments

* remove mocking useParams

* refactor provideTags and invalidateTags

* improves in rtk tags and createdBy type

* fix last review comments

* increase warning timeout to solve issues with unit tests

* add AnErrorOccured content if we have errors

* fix type error

* fix condition

* remove new line

---------

Co-authored-by: Fernando Chavez <fernando.chavez@strapi.io>
2023-12-13 15:59:37 +01:00

111 lines
2.4 KiB
TypeScript

import { Attribute, Common } from '@strapi/types';
import type { Release, Pagination } from './releases';
import type { Entity } from '../types';
import type { errors } from '@strapi/utils';
type ReleaseActionEntry = Entity & {
// Entity attributes
[key: string]: Attribute.Any;
} & {
locale: string;
};
type ReleaseActionEntryData = {
id: ReleaseActionEntry['id'];
locale?: {
name: string;
code: string;
};
contentType: {
mainFieldValue?: string;
displayName: string;
};
};
export interface ReleaseAction extends Entity {
type: 'publish' | 'unpublish';
entry: ReleaseActionEntry;
contentType: Common.UID.ContentType;
release: Release;
}
/**
* POST /content-releases/:releaseId/actions - Create a release action
*/
export declare namespace CreateReleaseAction {
export interface Request {
params: {
releaseId: Release['id'];
};
body: {
type: ReleaseAction['type'];
entry: {
id: ReleaseActionEntry['id'];
contentType: Common.UID.ContentType;
};
};
}
export interface Response {
data: ReleaseAction;
error?: errors.ApplicationError | errors.ValidationError | errors.NotFoundError;
}
}
/**
* GET /content-releases/:id/actions - Get all release actions
*/
export declare namespace GetReleaseActions {
export interface Request {
params: {
releaseId: Release['id'];
};
query?: Partial<Pick<Pagination, 'page' | 'pageSize'>>;
}
export interface Response {
data: Array<ReleaseAction & { entry: ReleaseActionEntryData }>;
meta: {
pagination: Pagination;
};
}
}
/*
* DELETE /content-releases/:releaseId/actions/:actionId - Delete a release action
*/
export declare namespace DeleteReleaseAction {
export interface Request {
params: {
actionId: ReleaseAction['id'];
releaseId: Release['id'];
};
}
export interface Response {
data: ReleaseAction;
error?: errors.ApplicationError | errors.NotFoundError;
}
}
/*
* PUT /content-releases/:releaseId/actions/:actionId - Update a release action
*/
export declare namespace UpdateReleaseAction {
export interface Request {
params: {
actionId: ReleaseAction['id'];
releaseId: ReleaseAction['id'];
};
body: {
type: ReleaseAction['type'];
};
}
export interface Response {
data: ReleaseAction;
error?: errors.ApplicationError | errors.ValidationError | errors.NotFoundError;
}
}