feat: restructure into XFlow monorepo with Nuxt 4, Modular Onion Monolith, Android client, and Desktop CLI
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { addListItemUseCase } from '../../../modules/notes-lists';
|
||||
import { getAuthUser } from '../../../utils/auth';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const user = getAuthUser(event);
|
||||
const body = await readBody(event);
|
||||
|
||||
const ownerId = user?.id || body.ownerId || 'default-user';
|
||||
const { title, listId, listTitle, category, description, priority, metadata } = body;
|
||||
|
||||
if (!title) {
|
||||
throw createError({ statusCode: 400, message: 'Item title is required' });
|
||||
}
|
||||
|
||||
const result = await addListItemUseCase.execute({
|
||||
title,
|
||||
listId,
|
||||
listTitle,
|
||||
category,
|
||||
description,
|
||||
priority,
|
||||
metadata,
|
||||
ownerId
|
||||
});
|
||||
|
||||
if (result.isFailure) {
|
||||
const error = result.getError();
|
||||
throw createError({ statusCode: error.statusCode || 400, message: error.message });
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
item: result.getValue().toJSON()
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user