<commit_before>Resource = require '../model/Resource'
Connection = require '../model/Connection'
User = require '../model/User'
Logger = require '../log/logger'

module.exports = class VoteDAO

  constructor: ->
    @logger = new Logger('VoteDAO')

  create: (data, userId, _) ->
    creator = User.find(userId, _)
    votedConnection = Connection.find(data.fromNodeId, _)
    creator.connectTo(votedConnection, creator, data, _)

  read: (id, _) ->
    Connection.find(id, _)

  update: (id, newData, _) ->
    connection = Connection.find(id, _)
    connection.update(newData, _)
  return connection

  delete: (id, _) ->
    connection = Connection.find(id, _)
    connection.delete _<commit_msg>fixed minor bug<commit_after>Resource = require '../model/Resource'
Connection = require '../model/Connection'
User = require '../model/User'
Logger = require '../log/logger'

module.exports = class VoteDAO

  constructor: ->
    @logger = new Logger('VoteDAO')

  create: (data, userId, _) ->
    creator = User.find(userId, _)
    votedConnection = Connection.find(data.fromNodeId, _)
    creator.connectTo(votedConnection, creator, data, _)

  read: (id, _) ->
    Connection.find(id, _)

  update: (id, newData, _) ->
    connection = Connection.find(id, _)
    connection.update(newData, _)
    return connection

  delete: (id, _) ->
    connection = Connection.find(id, _)
    connection.delete _
{'fraction_non_alphanumeric': 0.14835948644793154, 'fraction_numerical': 0.0, 'mean_word_length': 3.4258675078864353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6112075', 'n_tokens_mistral': 449, 'n_tokens_neox': 446, 'n_words': 92}