todo,todo-backend: add tag field to TodoItems

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-11 22:10:47 +01:00
parent 378f77b4f6
commit c07728eec8
10 changed files with 21 additions and 6 deletions
@@ -96,8 +96,9 @@ export class TodoScmReader implements TodoReader {
});
todos.push(
...items.map(({ lineNumber, text, author }) => ({
...items.map(({ lineNumber, text, tag, author }) => ({
text,
tag,
author,
lineNumber,
repoFilePath: file.path,
@@ -34,6 +34,7 @@ export function createTodoParser(options: TodoParserOptions = {}): TodoParser {
return comments.map(comment => ({
text: comment.text,
tag: comment.tag,
author: comment.ref,
lineNumber: comment.line,
}));
@@ -18,6 +18,9 @@ export type TodoItem = {
/** The contents of the TODO comment */
text: string;
/** The tag used, e.g. TODO, FIXME */
tag: string;
/** References author, if any */
author?: string;
@@ -59,6 +62,7 @@ type TodoParserContext = {
type TodoParserResult = {
text: string;
tag: string;
author?: string;
lineNumber: number;
};
@@ -21,7 +21,7 @@ import { createRouter } from './router';
import { TodoService } from './types';
const mockListBody = {
items: [{ text: 'my todo' }],
items: [{ text: 'my todo', tag: 'TODO' }],
totalCount: 1,
offset: 0,
limit: 10,
@@ -22,6 +22,7 @@ import { TodoService } from './types';
const ALLOWED_ORDER_BY_FIELDS = [
'text',
'tag',
'author',
'viewUrl',
'repoFilePath',
+1 -1
View File
@@ -22,7 +22,7 @@ export type ListTodosRequest = {
offset?: number;
limit?: number;
orderBy?: {
field: 'text' | 'author' | 'viewUrl' | 'repoFilePath';
field: 'text' | 'tag' | 'author' | 'viewUrl' | 'repoFilePath';
direction: 'asc' | 'desc';
};
};