Skip to content

Commit e2e1768

Browse files
committed
update dates
1 parent 57115cc commit e2e1768

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

apps/web/client/src/server/api/routers/project/project.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ export const projectRouter = createTRPCRouter({
117117
throw new Error('No data returned from storage upload');
118118
}
119119

120-
const dbPreviewImg = fromPreviewImg({
120+
const {
121+
previewImgUrl,
122+
previewImgPath,
123+
previewImgBucket,
124+
updatedPreviewImgAt,
125+
} = fromPreviewImg({
121126
type: 'storage',
122127
storagePath: {
123128
bucket: STORAGE_BUCKETS.PREVIEW_IMAGES,
@@ -127,10 +132,10 @@ export const projectRouter = createTRPCRouter({
127132

128133
await ctx.db.update(projects)
129134
.set({
130-
previewImgUrl: dbPreviewImg.previewImgUrl,
131-
previewImgPath: dbPreviewImg.previewImgPath,
132-
previewImgBucket: dbPreviewImg.previewImgBucket,
133-
updatedPreviewImgAt: dbPreviewImg.updatedPreviewImgAt,
135+
previewImgUrl,
136+
previewImgPath,
137+
previewImgBucket,
138+
updatedPreviewImgAt,
134139
updatedAt: new Date(),
135140
})
136141
.where(eq(projects.id, project.id));

packages/db/src/dto/project/project.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export const toProject = (
1616
updatedAt: dbProject.updatedAt.toISOString(),
1717
previewImg: toPreviewImg(dbProject),
1818
description: dbProject.description,
19-
updatedPreviewImgAt: dbProject.updatedPreviewImgAt ? new Date(dbProject.updatedPreviewImgAt) : null,
19+
updatedPreviewImgAt: dbProject.updatedPreviewImgAt,
2020
},
2121
};
2222
};
2323

2424
export const fromProject = (project: Project): DbProject => {
25-
const { previewImgUrl, previewImgPath, previewImgBucket } = fromPreviewImg(project.metadata.previewImg);
25+
const { previewImgUrl, previewImgPath, previewImgBucket, updatedPreviewImgAt } = fromPreviewImg(project.metadata.previewImg);
2626
return {
2727
id: project.id,
2828
name: project.name,
@@ -34,7 +34,7 @@ export const fromProject = (project: Project): DbProject => {
3434
previewImgUrl,
3535
previewImgPath,
3636
previewImgBucket,
37-
updatedPreviewImgAt: project.metadata.updatedPreviewImgAt ? new Date(project.metadata.updatedPreviewImgAt) : null,
37+
updatedPreviewImgAt,
3838
};
3939
};
4040

0 commit comments

Comments
 (0)