mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 01:38:10 +00:00

* feat(content-releases): add status to releases * add docs and fix e2e error * Update docs/docs/docs/01-core/content-releases/00-intro.md Co-authored-by: Simone <startae14@gmail.com> * Update docs/docs/docs/01-core/content-releases/00-intro.md Co-authored-by: Simone <startae14@gmail.com> * Update docs/docs/docs/01-core/content-releases/00-intro.md Co-authored-by: Simone <startae14@gmail.com> * apply marks feedback * don't throw error on lifecycle hooks inside releases * handle when actions are not valid anymore * await for entry validation on releases edit entry * check if are changes in content types attributes to revalidate * fix e2e test * apply marks feedback --------- Co-authored-by: Simone <startae14@gmail.com>
125 lines
2.9 KiB
TypeScript
125 lines
2.9 KiB
TypeScript
import { Attribute, Common, Schema } from '@strapi/types';
|
|
import type { Release, Pagination } from './releases';
|
|
import type { Entity } from '../types';
|
|
|
|
import type { errors } from '@strapi/utils';
|
|
|
|
export type ReleaseActionEntry = Entity & {
|
|
// Entity attributes
|
|
[key: string]: Attribute.Any;
|
|
} & {
|
|
locale?: string;
|
|
};
|
|
|
|
export interface ReleaseAction extends Entity {
|
|
type: 'publish' | 'unpublish';
|
|
entry: ReleaseActionEntry;
|
|
contentType: Common.UID.ContentType;
|
|
locale?: string;
|
|
release: Release;
|
|
isEntryValid: boolean;
|
|
}
|
|
|
|
export interface FormattedReleaseAction extends Entity {
|
|
type: 'publish' | 'unpublish';
|
|
entry: ReleaseActionEntry;
|
|
contentType: {
|
|
uid: Common.UID.ContentType;
|
|
mainFieldValue?: string;
|
|
displayName: string;
|
|
};
|
|
locale?: {
|
|
name: string;
|
|
code: string;
|
|
};
|
|
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'];
|
|
locale?: ReleaseActionEntry['locale'];
|
|
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 type ReleaseActionGroupBy = 'contentType' | 'action' | 'locale';
|
|
export declare namespace GetReleaseActions {
|
|
export interface Request {
|
|
params: {
|
|
releaseId: Release['id'];
|
|
};
|
|
query?: Partial<Pick<Pagination, 'page' | 'pageSize'>> & {
|
|
groupBy?: ReleaseActionGroupBy;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
[key: string]: Array<FormattedReleaseAction>;
|
|
};
|
|
meta: {
|
|
pagination: Pagination;
|
|
contentTypes: Record<Schema.ContentType['uid'], Schema.ContentType>;
|
|
components: Record<Schema.Component['uid'], Schema.Component>;
|
|
};
|
|
}
|
|
}
|
|
|
|
/*
|
|
* 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;
|
|
}
|
|
}
|