view src/commenttoesn.coffee @ 12:f190abf340ef

fixed some problems with facebook (caused by developers.facebook.com) removed fql :D
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 12 Jun 2014 10:23:05 +0200
parents 98a070c98982
children
line wrap: on
line source
# Copyright (C) 2014 by Intevation GmbH
# Author: Mathias Gebbe <mgebbe@intevation.de>
#
# This file is Free Software under the Apache License, Version 2.0;
# and comes with NO WARRANTY!
# See the documentation coming with pumpbridge for details.

_ = require("underscore")
async = require("async")
DatabankObject = require("databank").DatabankObject
CommentToESN = DatabankObject.subClass("CommentToESN")

CommentToESN.schema =
  pkey: "uid"
  fields: [
    "ESNPost"
    "pumpComment"
    "created"
    "updated"
  ]
  indices: [
    "ESNPost"
    "pumpComment"
  ]

CommentToESN.beforeCreate = (props, callback) ->
  if not props.ESNPost or not props.pumpComment
    callback new Error("Need 'ESNPost' and 'pumpComment'"), null
    return
  props.uid = CommentToESN.key(props.pumpComment, props.ESNPost)
  props.created = Date.now()
  props.updated = Date.now()
  callback null, props
  return

CommentToESN::beforeSave = (callback) ->
  props = this
  if not props.ESNPost or not props.pumpComment
    callback new Error("Need 'ESNPost' and 'pumpComment'"), null
    return
  props.updated = Date.now()
  callback null
  return

CommentToESN.key = (pumpComment, ESNPost) ->
  pumpComment + "_to_" + ESNPost

module.exports = CommentToESN
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)