Skip to content

Instantly share code, notes, and snippets.

View IwateKyle's full-sized avatar
💭
looking into Go-fiber again.

Kyle Manning IwateKyle

💭
looking into Go-fiber again.
View GitHub Profile
@IwateKyle
IwateKyle / gist:5e592a1e7e766789f983e4a04d84ed61
Created September 11, 2023 03:35
PocketBase - updating a record's fields before the request is created or updated in the database.
onRecordBeforeCreateRequest((e) => {
const requestInfo = $apis.requestInfo(e.httpContext);
// Update createdBy and updatedBy fields
if (requestInfo.authRecord !== null) {
e.record.set(
'createdBy',
`${requestInfo.authRecord.collection().name} ${requestInfo.authRecord.id}`
);
e.record.set(