pagination
{
"data": {
"items": [
{
...
"preference": "family",
"phone": "9849192759",
"lat": 27.717199999999998,
...
}
],
"metadata": {
"per": 2,
"total": 4,
"page": 2
}
}
}

vapor
func create(req: Request) throws -> EventLoopFuture<Room> {
let room = try req.content.decode(Room.self)
return room.create(on: req.db).map { room }
}
class Hotel < ApplicationRecord  validate :check_email?   def check_email?
errors.add :base, "Hotel email must be same as user's email!"
unless self.email == self.user.email
end
end

Therubyracer in mac Bigsur

brew install v8@3.15
bundle config build.libv8 --with-system-v8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8@3.15)
bundle install
many to many

Migrations
def change do
alter table(:events) do
modify(:title, :string, null: true, from: :string) # Title column is now nullable
end
end
defmodule Tailwind.Repo.Migrations.AddedDistrictIdToRoom do   use Ecto.Migration
def change do
alter table :rooms do
add :district_id, references( :districts, on_delete: :delete_all)
end
end
end

<div…

Sis Ccr

Depths of ocean could not swallow me.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store