Skip to content

Commit f4d97b6

Browse files
committed
Refactor todo example to use TodoTask object
Replaces CRM-related objects with a TodoTask object in the todo example. Updates configuration and schema to reflect the new todo domain, changes the server port to 3001, and enables API for the TodoTask object.
1 parent 8a1d199 commit f4d97b6

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

examples/server/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ app.delete('/api/v1/data/:object/:id', async (c) => {
120120
});
121121

122122
// 4. Start Server
123-
const port = 3000;
123+
const port = 3001;
124124
console.log(`Server is running on http://localhost:${port}`);
125125

126126
serve({
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
import { App } from '@objectstack/spec';
2-
import { Account } from './src/domains/crm/account.object';
3-
import { Contact } from './src/domains/crm/contact.object';
4-
import { Opportunity } from './src/domains/crm/opportunity.object';
2+
import { TodoTask } from './src/domains/todo/task.object';
53

64
export default App.create({
7-
name: 'crm_example',
8-
label: 'CRM App',
9-
description: 'A simple CRM example demonstrating ObjectStack Protocol',
5+
name: 'todo_app',
6+
label: 'Todo App',
7+
description: 'A simple Todo example demonstrating ObjectStack Protocol',
108
version: '1.0.0',
119
objects: [
12-
Account,
13-
Contact,
14-
Opportunity
10+
TodoTask
1511
],
1612
menus: [
1713
{
18-
label: 'Sales',
14+
label: 'Tasks',
1915
items: [
20-
{ type: 'object', object: 'account' },
21-
{ type: 'object', object: 'contact' },
22-
{ type: 'object', object: 'opportunity' }
16+
{ type: 'object', object: 'todo_task' }
2317
]
2418
}
2519
]
26-
});
20+
});

examples/todo/src/domains/todo/task.object.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { ObjectSchema, Field } from '@objectstack/spec';
22

3-
export const Task = ObjectSchema.create({
4-
name: 'task',
5-
label: 'Task',
3+
export const TodoTask = ObjectSchema.create({
4+
name: 'todo_task',
5+
label: 'Todo Task',
66
icon: 'check-square',
7+
enable: {
8+
apiEnabled: true,
9+
},
710
fields: {
811
subject: Field.text({ required: true }),
912
due_date: Field.date(),

0 commit comments

Comments
 (0)