MCPcopy Create free account
hub / github.com/axe-api/axe-api / bindTimestampValues

Function bindTimestampValues

packages/axe-api/src/Handlers/Helpers.ts:36–54  ·  view source on GitHub ↗
(
  formData: Record<string, any>,
  model: IModelService,
  columnTypes: TimestampColumns[] = [],
)

Source from the content-addressed store, hash-verified

34import RedisAdaptor from "../Middlewares/RateLimit/RedisAdaptor";
35
36export const bindTimestampValues = (
37 formData: Record<string, any>,
38 model: IModelService,
39 columnTypes: TimestampColumns[] = [],
40) => {
41 if (
42 columnTypes.includes(TimestampColumns.CREATED_AT) &&
43 model.instance.createdAtColumn
44 ) {
45 formData[model.instance.createdAtColumn] = new Date();
46 }
47
48 if (
49 columnTypes.includes(TimestampColumns.UPDATED_AT) &&
50 model.instance.updatedAtColumn
51 ) {
52 formData[model.instance.updatedAtColumn] = new Date();
53 }
54};
55
56export const getMergedFormData = (
57 req: AxeRequest,

Callers 3

PreparePhase.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected