Custom LoopBack Model with Created/Modified
Asked Answered
P

2

5

It looks like the built in LoopBack models are baked with "create/modified" date fields. Is there an easy way to add this to "generated" models? I've been looking through the docs but can't find anything in the model docs- http://docs.strongloop.com/display/public/LB/Defining+models

Any suggestions?

Preface answered 18/2, 2015 at 21:39 Comment(0)
D
5

There is no built-in way ATM. I suggest using an operation hook mixed with new Date(). See http://docs.strongloop.com/display/public/LB/Operation+hooks#Operationhooks-beforesave.

Decant answered 19/2, 2015 at 5:10 Comment(0)
Q
8

I'm pretty sure this is what you are looking for: https://github.com/clarkbw/loopback-ds-timestamp-mixin

Quartana answered 2/6, 2015 at 13:10 Comment(1)
Very nice, this looks like a better approach than what I'm currently doing, thanks!Preface
D
5

There is no built-in way ATM. I suggest using an operation hook mixed with new Date(). See http://docs.strongloop.com/display/public/LB/Operation+hooks#Operationhooks-beforesave.

Decant answered 19/2, 2015 at 5:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.