<commit_before>require 'digest'
require 'api/lib/dbobjects'
require 'api/resources/groups/groups.objects'

module MojuraAPI

	class NewsItem < DbObject

		include DbObjectTags
		include DbObjectVotes
		include DbObjectRights

		def initialize(id = nil)
			super('news', id)
		end

		def load_fields
			yield :title, String, :required => true
			yield :category, String, :required => false, :validations => {matches_regexp: /^[a-zA-Z]+[\w\.-]*$/}
			yield :imageid, BSON::ObjectId, :required => true, :default => nil
			yield :timestamp, Time, :required => false, :default => Time.new
			yield :content, RichText, :required => true
		end

	end


	class NewsItems < DbObjects

		def initialize(where = {}, options = {})
			options[:sort] ||= {timestamp: -1}
			super('news', NewsItem, where, options)
		end

	end


end<commit_msg>Fixes News API, images shouldn't be required.<commit_after>require 'digest'
require 'api/lib/dbobjects'
require 'api/resources/groups/groups.objects'

module MojuraAPI

	class NewsItem < DbObject

		include DbObjectTags
		include DbObjectVotes
		include DbObjectRights

		def initialize(id = nil)
			super('news', id)
		end

		def load_fields
			yield :title, String, :required => true
			yield :category, String, :required => false, :validations => {matches_regexp: /^[a-zA-Z]+[\w\.-]*$/}
			yield :imageid, BSON::ObjectId, :required => false, :default => nil
			yield :timestamp, Time, :required => false, :default => Time.new
			yield :content, RichText, :required => true
		end

	end


	class NewsItems < DbObjects

		def initialize(where = {}, options = {})
			options[:sort] ||= {timestamp: -1}
			super('news', NewsItem, where, options)
		end

	end


end
{'fraction_non_alphanumeric': 0.137951450562463, 'fraction_numerical': 0.0011841326228537595, 'mean_word_length': 4.029761904761905, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '2250', 'n_tokens_mistral': 631, 'n_tokens_neox': 533, 'n_words': 155}