Añadir Time Zone a los Venues
This commit is contained in:
parent
3f0b87870c
commit
444d364f1a
@ -1,9 +1,11 @@
|
|||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const cdnHelper = require('../../helpers/cdn.helper');
|
const cdnHelper = require("../../helpers/cdn.helper");
|
||||||
|
|
||||||
module.exports = function (sequelize, DataTypes) {
|
module.exports = function (sequelize, DataTypes) {
|
||||||
const Venue = sequelize.define('Venue', {
|
const Venue = sequelize.define(
|
||||||
|
"Venue",
|
||||||
|
{
|
||||||
id: {
|
id: {
|
||||||
type: DataTypes.UUID,
|
type: DataTypes.UUID,
|
||||||
defaultValue: DataTypes.UUIDV4,
|
defaultValue: DataTypes.UUIDV4,
|
||||||
@ -50,18 +52,23 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
image_url: {
|
image_url: {
|
||||||
type: DataTypes.VIRTUAL,
|
type: DataTypes.VIRTUAL,
|
||||||
get: function () {
|
get: function () {
|
||||||
const city = this.get('city');
|
const city = this.get("city");
|
||||||
return cdnHelper.getCDNCityMediaUrl(city)
|
return cdnHelper.getCDNCityMediaUrl(city);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}, {
|
tz: {
|
||||||
tableName: 'venues',
|
type: DataTypes.STRING,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tableName: "venues",
|
||||||
freezeTableName: true,
|
freezeTableName: true,
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Venue.associate = function (models) {
|
Venue.associate = function (models) {
|
||||||
Venue.Events = Venue.hasMany(models.Event, { foreignKey: 'venueId', as: 'events' });
|
Venue.Events = Venue.hasMany(models.Event, { foreignKey: "venueId", as: "events" });
|
||||||
};
|
};
|
||||||
|
|
||||||
return Venue;
|
return Venue;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const Joi = require('joi');
|
const Joi = require("joi");
|
||||||
|
|
||||||
const VenueInputType = Joi.object().keys({
|
const VenueInputType = Joi.object().keys({
|
||||||
name: Joi.string().required(),
|
name: Joi.string().required(),
|
||||||
@ -9,7 +9,8 @@ const VenueInputType = Joi.object().keys({
|
|||||||
country: Joi.string().optional(),
|
country: Joi.string().optional(),
|
||||||
state: Joi.string().optional(),
|
state: Joi.string().optional(),
|
||||||
postal_code: Joi.string().optional(),
|
postal_code: Joi.string().optional(),
|
||||||
accessibility: Joi.string().optional()
|
accessibility: Joi.string().optional(),
|
||||||
|
tz: Joi.string().optional(),
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
const VenueOutputType = Joi.object().keys({
|
const VenueOutputType = Joi.object().keys({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user