mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
* add cms turbo app * add cms scripts to package.json * update README * update README * update files * fix formatting * fix populateAuthors * sync dependencies * update launch week field * update lint config * Coordinate the deps to be the same as the other apps. * Remove extra files. * Run prettier on the CMS files. * Add commands for cleaning and typechecking. * Fix weird version of @types/react in docs. * run pnpm install * fix pnpm-lock * fix cms lint --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
16 lines
379 B
TypeScript
16 lines
379 B
TypeScript
import type { CollectionBeforeChangeHook } from 'payload'
|
|
|
|
export const populatePublishedAt: CollectionBeforeChangeHook = ({ data, operation, req }) => {
|
|
if (operation === 'create' || operation === 'update') {
|
|
if (req.data && !req.data.publishedAt) {
|
|
const now = new Date()
|
|
return {
|
|
...data,
|
|
publishedAt: now,
|
|
}
|
|
}
|
|
}
|
|
|
|
return data
|
|
}
|