[OAE] Timestamp ?

2 views
Skip to first unread message

claire lozano

unread,
Jun 19, 2017, 5:27:31 AM6/19/17
to Open Academic Environment (OAE)
Hi everyone, 

I would like to know where I can find the function to generate the timestamp used in OAE ? (e.g. : the timestamp used in the table "LibraryIndex")

Thanks in advance, 
Claire L.

Miguel Laginha

unread,
Jun 19, 2017, 5:57:16 AM6/19/17
to claire lozano, Open Academic Environment (OAE)
Hi Claire,

That table doesn't hold any timestamp, at least in master :)

In any case, what we usually do is just to obtain Date.now() and then convert it to String, so it gets accepted into the database. You can check an example of that in oae-principals/lib/internal/dao.js.

Please notice that we are in the process of replacing the database driver and timestamp fields is one of the things that will be affected. Therefore, depending on when these features get merged, changes will have to be made. This is what that same file looks like with the new driver:

var now = Date.now();
var lastModified = now.toString();
var created = new Date(now).toUTCString();

var query = 'INSERT INTO "Principals" ("principalId", "tenantAlias", "displayName", "description", "visibility", "joinable", "lastModified", "createdBy", "created") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
    var parameters = [groupId, tenantAlias, displayName, description, visibility, joinable, lastModified, createdBy, created];
...

I hope that helps!
_ miguel




--
You received this message because you are subscribed to the Google Groups "Open Academic Environment (OAE)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oae+uns...@apereo.org.
To post to this group, send email to o...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/oae/.

Reply all
Reply to author
Forward
0 new messages