Skip to content

Commit 322900f

Browse files
Add schema
1 parent 59db881 commit 322900f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/schemas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as itemSchema } from "./item.schema";

src/schemas/item.schema.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import dynamoose from "dynamoose";
2+
import { v4 as uuidv4 } from "uuid";
3+
4+
const itemSchema = new dynamoose.Schema({
5+
id: {
6+
type: String,
7+
hashKey: true,
8+
default: () => uuidv4(),
9+
},
10+
name: {
11+
type: String,
12+
required: true,
13+
},
14+
description: {
15+
type: String,
16+
required: false,
17+
},
18+
createdAt: {
19+
type: Date,
20+
default: () => new Date(),
21+
},
22+
});
23+
24+
export default itemSchema;

0 commit comments

Comments
 (0)