feat: import and export tickets as CSV

Every ticket of a project can be downloaded as CSV, and a CSV exported
from TaskStream or from Jira can be imported: types, statuses, priorities
and people are matched by id or name, the rest falls back with a warning,
and parents are rebuilt. The settings page previews an import before it
creates anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 15:43:02 +02:00
parent d43fc620e9
commit 1076205acc
24 changed files with 1666 additions and 31 deletions

View File

@@ -8399,6 +8399,217 @@
"Webhooks"
]
}
},
"/api/projects/{project}/export.csv": {
"get": {
"description": "UTF-8 with BOM. Cells that a spreadsheet would run as a formula start with a quote mark.",
"operationId": "TransferController_exportCsv",
"parameters": [
{
"name": "project",
"required": true,
"in": "path",
"description": "Project id or key",
"schema": {
"example": "WEB",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "The CSV file"
},
"400": {
"description": "Invalid input",
"content": {
"text/csv": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"text/csv": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"text/csv": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"text/csv": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
},
{}
],
"summary": "Every ticket of the project as CSV",
"tags": [
"Import and export"
]
}
},
"/api/projects/{project}/import": {
"post": {
"description": "TaskStream export or Jira CSV export, up to 5 MB and 2000 rows. Types, statuses and people are matched by id or name; the rest falls back with a warning. With dryRun=true nothing is created.",
"operationId": "TransferController_importCsv",
"parameters": [
{
"name": "project",
"required": true,
"in": "path",
"description": "Project id or key",
"schema": {
"example": "WEB",
"type": "string"
}
},
{
"name": "dryRun",
"required": false,
"in": "query",
"description": "Only tell what would be created",
"schema": {
"default": false,
"allOf": [
{
"$ref": "#/components/schemas/Object"
}
]
}
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
}
},
"required": [
"file"
]
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportReportDto"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"401": {
"description": "Missing or rejected Pireon token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"403": {
"description": "Not a member of the project (or not allowed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"409": {
"description": "Someone changed it at the same time: retry",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
},
"422": {
"description": "Business rule (e.g. a transition the workflow forbids)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiErrorDto"
}
}
}
}
},
"security": [
{
"pireon-oauth": []
},
{
"pireon": []
}
],
"summary": "Create tickets from a CSV (owners and admins)",
"tags": [
"Import and export"
]
}
}
},
"info": {
@@ -11491,6 +11702,78 @@
"description": "Paused webhooks get nothing"
}
}
},
"ImportLineDto": {
"type": "object",
"properties": {
"line": {
"type": "number",
"description": "Line of the file (the header is 1)"
},
"reason": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"line"
]
},
"ImportReportDto": {
"type": "object",
"properties": {
"format": {
"type": "string",
"enum": [
"taskstream",
"jira"
]
},
"dryRun": {
"type": "boolean",
"description": "Nothing was created: a preview"
},
"rows": {
"type": "number",
"description": "Rows that become tickets"
},
"created": {
"type": "number"
},
"keys": {
"example": [
"WEB-41",
"WEB-42"
],
"type": "array",
"items": {
"type": "string"
}
},
"skipped": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ImportLineDto"
}
},
"warnings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ImportLineDto"
}
}
},
"required": [
"format",
"dryRun",
"rows",
"created",
"keys",
"skipped",
"warnings"
]
}
}
}

View File

@@ -1209,6 +1209,46 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/projects/{project}/export.csv": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Every ticket of the project as CSV
* @description UTF-8 with BOM. Cells that a spreadsheet would run as a formula start with a quote mark.
*/
get: operations["TransferController_exportCsv"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/projects/{project}/import": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Create tickets from a CSV (owners and admins)
* @description TaskStream export or Jira CSV export, up to 5 MB and 2000 rows. Types, statuses and people are matched by id or name; the rest falls back with a warning. With dryRun=true nothing is created.
*/
post: operations["TransferController_importCsv"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -2226,6 +2266,30 @@ export interface components {
/** @description Paused webhooks get nothing */
active?: boolean;
};
ImportLineDto: {
/** @description Line of the file (the header is 1) */
line: number;
reason?: string;
message?: string;
};
ImportReportDto: {
/** @enum {string} */
format: "taskstream" | "jira";
/** @description Nothing was created: a preview */
dryRun: boolean;
/** @description Rows that become tickets */
rows: number;
created: number;
/**
* @example [
* "WEB-41",
* "WEB-42"
* ]
*/
keys: string[];
skipped: components["schemas"]["ImportLineDto"][];
warnings: components["schemas"]["ImportLineDto"][];
};
};
responses: never;
parameters: never;
@@ -8051,4 +8115,147 @@ export interface operations {
};
};
};
TransferController_exportCsv: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description The CSV file */
200: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Invalid input */
400: {
headers: {
[name: string]: unknown;
};
content: {
"text/csv": components["schemas"]["ApiErrorDto"];
};
};
/** @description Missing or rejected Pireon token */
401: {
headers: {
[name: string]: unknown;
};
content: {
"text/csv": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not a member of the project (or not allowed) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"text/csv": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"text/csv": components["schemas"]["ApiErrorDto"];
};
};
};
};
TransferController_importCsv: {
parameters: {
query?: {
/** @description Only tell what would be created */
dryRun?: components["schemas"]["Object"];
};
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody: {
content: {
"multipart/form-data": {
/** Format: binary */
file: string;
};
};
};
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ImportReportDto"];
};
};
/** @description Invalid input */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Missing or rejected Pireon token */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not a member of the project (or not allowed) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Someone changed it at the same time: retry */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Business rule (e.g. a transition the workflow forbids) */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
};
};
}