1
0
Fork 0

Return word inflections

This commit is contained in:
Alex Kotov 2023-02-19 09:29:32 +04:00
parent f74bfce7a8
commit a427b048d9
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -32,6 +32,7 @@ get '/words/:id' do
part_of_speech: context.part_of_speech_name(word_id),
commentary: word_info[:commentary],
translations: context.translations(word_id),
inflections: word_info[:inflections],
examples: context.examples(word_id),
})
end
@ -79,7 +80,7 @@ public
word_id = Integer word_id
row = @db_conn.exec_params(
'SELECT primary_form, commentary FROM words WHERE id = $1',
'SELECT primary_form, commentary, inflections FROM words WHERE id = $1',
[word_id],
).to_a.first
@ -89,9 +90,13 @@ public
commentary = String(row['commentary']).strip.freeze
commentary = nil if commentary.empty?
inflections = String(row['inflections']).strip.freeze
inflections = nil if inflections.empty?
{
primary_form: primary_form,
commentary: commentary,
inflections: inflections,
}.freeze
end