Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:NUTFes/NUTMEG-Seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
KokiWakatsuki committed Apr 25, 2024
2 parents 32555be + dae3e8e commit bb7b1c1
Show file tree
Hide file tree
Showing 31 changed files with 4,200 additions and 5,334 deletions.
13 changes: 10 additions & 3 deletions api/app/controllers/api/v1/records_api_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class Api::V1::RecordsApiController < ApplicationController
def get_records_for_index
@record = Record.with_teacher_and_skills
render json: @record
# releaseカラムがtrueになっているレコードのみを取得
@records = Record.where(release: true).with_teacher_and_skills
render json: @records
end

def get_record_for_index_reload
Expand All @@ -14,12 +15,18 @@ def get_record_for_view
render json: @record
end


def get_teacher_by_record
@record = Record.get_teacher(params[:id])
render json: @record
end

# app/controllers/api/v1/records_api_controller.rb
def get_drafts_for_user
user_id = params[:user_id] # または、認証されたユーザーのIDを直接取得
@records = Record.where(user_id: user_id, release: false)
render json: @records
end

def get_record_from_user
user = User.find(params[:id])
teachers = user.teachers.order(updated_at: "DESC")
Expand Down
2 changes: 1 addition & 1 deletion api/app/controllers/records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_record

# Only allow a list of trusted parameters through.
def record_params
params.require(:record).permit(:title, :content, :homework, :user_id, :chapter_id)
params.require(:record).permit(:title, :content, :homework, :user_id, :chapter_id, :release)
end
def teacher_params
params.require(:teacher).permit(:user_id, :record_id)
Expand Down
10 changes: 5 additions & 5 deletions api/bin/rails
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
load File.expand_path("spring", __dir__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative "../config/boot"
require "rails/commands"
#!/usr/bin/env ruby
load File.expand_path("spring", __dir__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative "../config/boot"
require "rails/commands"
2 changes: 1 addition & 1 deletion api/config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eXqxkmurqSMGQLTcA4rpLtPwuuD+MCPVm2PYdaHdhPOT4tdXQSbdOJtX7HVe/6iyHGpQN22aZOLH8OkoTBPPhIBUMc8TD642OceiYDIq0YhtgvCw/MG+o5ncsioyLFw9FEMuohTRpS1ryrovuJtvXAciO58iz7J86lAB8CUzhVrlOJXMDRAX4YFS0+sh3f9xQZho7t2Y0g4k09leaCjWeKdD3QeMlYf0PdmigOre7hQoHhUw3viRjCqm9p4L/75WLL07MQVppS7lF0QLY/dh8L6L76H7aWw1dsUyNMsXIgQoEEEAiKJq9OPJTpSqC0Rdar+d/gROGw5NuSYtPUApiTygbpj3l0uJxzSPpsmrAKJihkxv8TWl2UHVdQW7b3kUFLFnIud8ccRa9UXOOQIG/iO/tiiwcXeSXpD2--naOrfFmuyFZmSsQM--AqntabeEV/PNcpBu/XLXXg==
f8ko3J21oiEzt+rXqJbVgEJ5XVCMDljL/dqszMhBp0Sg5eVv+OV8nlMldfhGk3FYw2QFhV1gy0rziJ+NQwrBqOQpfveibMbKjwLYDJK5D9lTG3tHifLZoYVbhG4tp6pV8T2o6IxH75bcIKGj8krtpkL+Ijpz4xNUAmslvz/tEXUxtydvrGM+Z/GXqhoNZiVBjwpNWsahleeRvdG8OqnqrzbPxrCKJRoJmNRs537HEZlhwtn8xsUYQ1DBg9Syg3SA0HsC39ouAoKamc2g4k0fHSneSgVuZmFNeh7XwGSMNKpwxZCv4EXF79Lk8/7xDBrdONZ+AEQted7/CdGEV5fvoTu7wc9MHWbleUTClb1cnlbzGMpaKL2bmvOyy3xkIDMVykpT/YJkc+P5p/aNdAvD2ez4eopExX1Bioq2--wdAQtBxw3dn/BJo2--1Cr/bd3OcCoyXUJJ6WN3Ug==
1 change: 1 addition & 0 deletions api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
get "/get_record_for_index_reload/:id" => "records_api#get_record_for_index_reload"
get "/get_record_for_view/:id" => "records_api#get_record_for_view"
get "get_records_from_user/:id" => "records#get_record_from_user"
get 'get_drafts_for_user/:user_id' => 'records_api#get_drafts_for_user'

# curriculum
get "get_current_user" => "current_user#get_current_user"
Expand Down
5 changes: 5 additions & 0 deletions api/db/migrate/20240225131333_add_release_to_records.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddReleaseToRecords < ActiveRecord::Migration[6.1]
def change
add_column :records, :release, :boolean, null: false, default: false
end
end
3 changes: 2 additions & 1 deletion api/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_02_21_091509) do
ActiveRecord::Schema.define(version: 2024_02_25_131333) do

create_table "bureaus", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name"
Expand Down Expand Up @@ -95,6 +95,7 @@
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "chapter_id"
t.boolean "release", default: false, null: false
end

create_table "roles", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
Expand Down
1 change: 1 addition & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
command: bash -c "npm run start"
volumes:
- ./view:/app
- ./view/next-project/node_modules:/app/node_modules
stdin_open: true
tty: true
environment:
Expand Down
5 changes: 4 additions & 1 deletion view/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:16.13.0
FROM node:20.11.0

WORKDIR /app/next-project

COPY ./ /app
RUN npm install

ENV API_URL='http://localhost:3000'
1 change: 0 additions & 1 deletion view/next-project/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
Loading

0 comments on commit bb7b1c1

Please sign in to comment.