mirror of
https://github.com/czhu12/canine.git
synced 2025-12-17 17:04:37 -06:00
update tokens
This commit is contained in:
@@ -6,13 +6,15 @@
|
||||
# access_token :string not null
|
||||
# expires_at :datetime
|
||||
# last_used_at :datetime
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
# index_api_tokens_on_access_token (access_token) UNIQUE
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<%= form_with model: api_token do |form| %>
|
||||
<%= render "shared/error_messages", resource: form.object %>
|
||||
<div class="form-group">
|
||||
<%= form.label :name %>
|
||||
<%= form.text_field :name, class: "input input-bordered w-full max-w-sm", required: true, placeholder: "my-api-token" %>
|
||||
</div>
|
||||
<%= render "api_tokens/expiry_date_field", form: form %>
|
||||
|
||||
<div class="form-footer">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= settings_layout do %>
|
||||
<%= turbo_frame_tag "api_token" do %>
|
||||
<div class="font-lg font-bold mt-4">
|
||||
<div class="font-lg font-bold my-4">
|
||||
Add API Token
|
||||
</div>
|
||||
<%= render "api_tokens/form", api_token: @api_token %>
|
||||
|
||||
@@ -2,10 +2,12 @@ class CreateApiTokens < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :api_tokens do |t|
|
||||
t.references :user, null: false, foreign_key: true
|
||||
t.string :name, null: false
|
||||
t.string :access_token, null: false
|
||||
t.datetime :last_used_at
|
||||
t.datetime :expires_at
|
||||
t.timestamps
|
||||
end
|
||||
add_index :api_tokens, :access_token, unique: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
# access_token :string not null
|
||||
# expires_at :datetime
|
||||
# last_used_at :datetime
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
# index_api_tokens_on_access_token (access_token) UNIQUE
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
# access_token :string not null
|
||||
# expires_at :datetime
|
||||
# last_used_at :datetime
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
# index_api_tokens_on_access_token (access_token) UNIQUE
|
||||
# index_api_tokens_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user