Skip to content

Commit

Permalink
change to use single schema member
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Prodromou committed May 9, 2012
1 parent c3039ed commit b3542a8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 38 deletions.
16 changes: 7 additions & 9 deletions lib/model/accesstoken.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ var databank = require('databank'),
var AccessToken = DatabankObject.subClass('accesstoken');

AccessToken.schema = {
accesstoken: {
pkey: 'token',
fields: ['token_secret',
'consumer_key',
'username',
'created',
'updated'],
indices: ['username', 'consumer_key']
}
pkey: 'token',
fields: ['token_secret',
'consumer_key',
'username',
'created',
'updated'],
indices: ['username', 'consumer_key']
};

exports.AccessToken = AccessToken;
Expand Down
24 changes: 12 additions & 12 deletions lib/model/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ var databank = require('databank'),
var Client = DatabankObject.subClass('client');

Client.schema = {
'client': {pkey: 'consumer_key',
fields: ['title',
'description',
'host',
'secret',
'contacts',
'logo_url',
'redirect_uris',
'type',
'created',
'updated'],
indices: ['title']}
pkey: 'consumer_key',
fields: ['title',
'description',
'host',
'secret',
'contacts',
'logo_url',
'redirect_uris',
'type',
'created',
'updated'],
indices: ['title']
};

Client.keyPair = function(callback) {
Expand Down
26 changes: 12 additions & 14 deletions lib/model/requesttoken.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@ var databank = require('databank'),
var RequestToken = DatabankObject.subClass('requesttoken');

RequestToken.schema = {
requesttoken: {
pkey: 'token',
fields: ['consumer_key',
'callback',
'used',
'token_secret',
'verifier',
'authenticated',
'username',
'access_token',
'created',
'updated'],
indices: ['access_token']
}
pkey: 'token',
fields: ['consumer_key',
'callback',
'used',
'token_secret',
'verifier',
'authenticated',
'username',
'access_token',
'created',
'updated'],
indices: ['access_token']
};

exports.RequestToken = RequestToken;
Expand Down
6 changes: 3 additions & 3 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ var getSchema = function() {
schema.usercount = {'pkey': 'id'};

_.extend(schema, Stream.schema);
_.extend(schema, Client.schema);
_.extend(schema, RequestToken.schema);
_.extend(schema, AccessToken.schema);
schema[Client.type] = Client.schema;
schema[RequestToken.type] = RequestToken.schema;
schema[AccessToken.type] = AccessToken.schema;

for (i = 0; i < Activity.objectTypes.length; i++) {
type = Activity.objectTypes[i];
Expand Down

0 comments on commit b3542a8

Please sign in to comment.