spee.ch/models/claim.js
2017-10-26 08:31:38 -07:00

158 lines
2.9 KiB
JavaScript

module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, ARRAY, DECIMAL, DOUBLE }) => {
const Claim = sequelize.define(
'Claim',
{
address: {
type : STRING,
default: null,
},
amount: {
type : STRING,
default: null,
},
claimId: {
type : STRING,
default: null,
},
claimSequence: {
type : INTEGER,
default: null,
},
decodedClaim: {
type : BOOLEAN,
default: null,
},
depth: {
type : INTEGER,
default: null,
},
effectiveAmount: {
type : STRING,
default: null,
},
hasSignature: {
type : BOOLEAN,
default: null,
},
height: {
type : STRING,
default: null,
},
hex: {
type : TEXT('long'),
default: null,
},
name: {
type : STRING,
default: null,
},
nout: {
type : INTEGER,
default: null,
},
txid: {
type : STRING,
default: null,
},
validAtHeight: {
type : STRING,
default: null,
},
outpoint: {
type : STRING,
default: null,
},
claimType: {
type : STRING,
default: null,
},
certificateId: {
type : STRING,
default: null,
},
author: {
type : STRING,
default: null,
},
description: {
type : TEXT('long'),
default: null,
},
language: {
type : STRING,
default: null,
},
license: {
type : STRING,
default: null,
},
licenseUrl: {
type : STRING,
default: null,
},
nsfw: {
type : BOOLEAN,
default: null,
},
preview: {
type : STRING,
default: null,
},
thumbnail: {
type : STRING,
default: null,
},
title: {
type : STRING,
default: null,
},
metadataVersion: {
type : STRING,
default: null,
},
contentType: {
type : STRING,
default: null,
},
source: {
type : STRING,
default: null,
},
sourceType: {
type : STRING,
default: null,
},
sourceVersion: {
type : STRING,
default: null,
},
streamVersion: {
type : STRING,
default: null,
},
valueVersion: {
type : STRING,
default: null,
},
channelName: {
type : STRING,
allowNull: true,
default : null,
},
},
{
freezeTableName: true,
}
);
Claim.associate = db => {
Claim.belongsTo(db.File, {
onDelete : 'cascade',
foreignKey: {
allowNull: true,
},
});
};
return Claim;
};