feat: add city and weather art models

- Create City model with attributes: name, country, latitude, longitude, and featured.
- Create WeatherArt model with attributes: weather_date, weather_condition, description, and prompt.
- Add migration files for creating cities and weather arts tables.
- Include fixture files for cities and weather arts for testing.
- Add basic test files for both models.

These changes introduce new models and database tables to support
city and weather art data, enabling future features related to
weather information and city management.
This commit is contained in:
songtianlun 2025-01-17 18:05:42 +08:00
parent 81843f0c08
commit 42e0da1aa0
8 changed files with 71 additions and 0 deletions

2
app/models/city.rb Normal file
View File

@ -0,0 +1,2 @@
class City < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class WeatherArt < ApplicationRecord
end

View File

@ -0,0 +1,13 @@
class CreateCities < ActiveRecord::Migration[8.0]
def change
create_table :cities do |t|
t.string :name
t.string :country
t.decimal :latitude
t.decimal :longitude
t.boolean :featured
t.timestamps
end
end
end

View File

@ -0,0 +1,12 @@
class CreateWeatherArts < ActiveRecord::Migration[8.0]
def change
create_table :weather_arts do |t|
t.date :weather_date
t.string :weather_condition
t.text :description
t.string :prompt
t.timestamps
end
end
end

15
test/fixtures/cities.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
country: MyString
latitude: 9.99
longitude: 9.99
featured: false
two:
name: MyString
country: MyString
latitude: 9.99
longitude: 9.99
featured: false

13
test/fixtures/weather_arts.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
weather_date: 2025-01-17
weather_condition: MyString
description: MyText
prompt: MyString
two:
weather_date: 2025-01-17
weather_condition: MyString
description: MyText
prompt: MyString

7
test/models/city_test.rb Normal file
View File

@ -0,0 +1,7 @@
require "test_helper"
class CityTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require "test_helper"
class WeatherArtTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end