-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ecfc19
commit 5e62c34
Showing
3 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{:objects | ||
{:Member | ||
{:description "メンバー" | ||
:fields | ||
{:id {:type (non-null Int) | ||
:description "メンバーID"} | ||
:name {:type (non-null String) | ||
:description "メンバー名"} | ||
:organization_id {:type (non-null Int) | ||
:description "所属組織ID"} | ||
:organization_name {:type (non-null String) | ||
:description "所属組織名"}}} | ||
|
||
:Artist | ||
{:description "アーティスト" | ||
:fields | ||
{:id {:type (non-null Int) | ||
:description "アーティストID"} | ||
:type {:type (non-null Int) | ||
:description "アーティストタイプ (1: グループ, 2: ソロ)"} | ||
:name {:type (non-null String) | ||
:description "アーティスト名"} | ||
:members {:type (list :Member) | ||
:description "メンバー一覧" | ||
:resolve :Artist/members}}} | ||
|
||
:Song | ||
{:description "楽曲" | ||
:fields | ||
{:id {:type (non-null Int) | ||
:description "楽曲ID"} | ||
:name {:type (non-null String) | ||
:description "楽曲名"} | ||
:artist_id {:type (non-null Int) | ||
:description "アーティストID"} | ||
:artist {:type (non-null :Artist) | ||
:description "アーティスト" | ||
:resolve :Song/artist} | ||
:release_date {:type (non-null String) | ||
:description "リリース日 (YYYY-MM-DD)"}}}} | ||
|
||
:queries | ||
{:member_by_id | ||
{:type :Member | ||
:description "IDによるメンバー取得" | ||
:args | ||
{:id {:type (non-null Int) | ||
:description "メンバーID"}} | ||
:resolve :query/member-by-id}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns aqoursql.graphql | ||
(:require [clojure.edn :as edn] | ||
[clojure.java.io :as io] | ||
[com.walmartlabs.lacinia.pedestal :as lacinia] | ||
[com.walmartlabs.lacinia.schema :as schema] | ||
[com.walmartlabs.lacinia.util :as util] | ||
[integrant.core :as ig])) | ||
|
||
(def resolver-map | ||
{;; TODO: implement fetch-member-by-id resolver | ||
:query/member-by-id (constantly nil) | ||
;; TODO: implement list-artist-members resolver | ||
:Artist/members (constantly []) | ||
;; TODO: implement fetch-artist-by-id resolver | ||
:Song/artist (constantly nil)}) | ||
|
||
(defmethod ig/init-key ::schema | ||
[_ _] | ||
(-> (io/resource "aqoursql/graphql-schema.edn") | ||
slurp | ||
edn/read-string | ||
(util/attach-resolvers resolver-map) | ||
schema/compile)) | ||
|
||
(defmethod ig/init-key ::service | ||
[_ {:keys [schema options]}] | ||
(lacinia/service-map schema options)) |