add proposal table
parent
e0d0707c90
commit
494a827e0a
|
@ -0,0 +1,58 @@
|
|||
-- Deploy cfp:proposal to pg
|
||||
-- requires: cfp
|
||||
-- requires: cfp_user
|
||||
-- requires: cfp_anonymous
|
||||
-- requires: set_updated_at
|
||||
-- requires: user
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE cfp.proposal(
|
||||
id SERIAL PRIMARY KEY,
|
||||
author_id INTEGER NOT NULL REFERENCES cfp.user(id),
|
||||
|
||||
-- talk info
|
||||
title TEXT NOT NULL,
|
||||
abstract TEXT NOT NULL,
|
||||
pitch TEXT NOT NULL,
|
||||
outline TEXT NOT NULL,
|
||||
feedback TEXT NOT NULL,
|
||||
|
||||
-- metadata
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
COMMENT ON TABLE cfp.proposal IS '@omit delete';
|
||||
|
||||
-- indexes
|
||||
|
||||
CREATE INDEX idx_proposal_author_id ON cfp.proposal(author_id);
|
||||
|
||||
-- triggers
|
||||
|
||||
CREATE TRIGGER update_updated_at
|
||||
BEFORE UPDATE ON cfp.proposal
|
||||
FOR EACH ROW EXECUTE PROCEDURE cfp.set_updated_at();
|
||||
|
||||
-- permissions
|
||||
|
||||
GRANT SELECT ON TABLE cfp.user TO cfp_user;
|
||||
|
||||
GRANT UPDATE (title, abstract, pitch, outline, feedback) ON TABLE cfp.proposal TO cfp_user;
|
||||
|
||||
ALTER TABLE cfp.proposal ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY update_proposal ON cfp.proposal
|
||||
FOR update
|
||||
USING (id = cfp.current_user_id());
|
||||
|
||||
CREATE POLICY select_own_proposal ON cfp.proposal
|
||||
FOR select
|
||||
USING (id = cfp.current_user_id());
|
||||
|
||||
CREATE POLICY select_all_proposals ON cfp.proposal
|
||||
FOR select
|
||||
USING (cfp.current_user_is_reviewer());
|
||||
|
||||
COMMIT;
|
|
@ -0,0 +1,18 @@
|
|||
-- Revert cfp:proposal from pg
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP POLICY select_all_proposals ON cfp.proposal;
|
||||
DROP POLICY select_own_proposal ON cfp.proposal;
|
||||
DROP POLICY update_proposal ON cfp.proposal;
|
||||
|
||||
REVOKE UPDATE (title, abstract, pitch, outline, feedback) ON TABLE cfp.proposal FROM cfp_user;
|
||||
REVOKE SELECT ON TABLE cfp.proposal FROM cfp_user;
|
||||
|
||||
DROP TRIGGER update_updated_at ON cfp.proposal;
|
||||
|
||||
DROP INDEX cfp.idx_proposal_author_id;
|
||||
|
||||
DROP TABLE cfp.proposal;
|
||||
|
||||
COMMIT;
|
|
@ -15,3 +15,4 @@ user [cfp current_user_id cfp_anonymous cfp_user set_updated_at] 2019-03-28T13:2
|
|||
user_account [user cfp_private] 2019-03-28T13:29:47Z Brian Hicks <brian@noredink.com> # add table for private user account info
|
||||
register [user user_account pgcrypto] 2019-03-28T13:39:35Z Brian Hicks <brian@noredink.com> # add a function to register a user
|
||||
authenticate [user_account cfp_anonymous] 2019-03-28T18:18:11Z Brian Hicks <brian@noredink.com> # add authenticate function
|
||||
proposal [cfp cfp_user cfp_anonymous set_updated_at user] 2019-03-28T19:59:58Z Brian Hicks <brian@noredink.com> # add proposal table
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
-- Verify cfp:proposal on pg
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- XXX Add verifications here.
|
||||
|
||||
ROLLBACK;
|
|
@ -0,0 +1,83 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Enum.ProposalsOrderBy exposing (ProposalsOrderBy(..), decoder, list, toString)
|
||||
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
|
||||
|
||||
{-| Methods to use when ordering `Proposal`.
|
||||
-}
|
||||
type ProposalsOrderBy
|
||||
= Natural
|
||||
| IdAsc
|
||||
| IdDesc
|
||||
| AuthorIdAsc
|
||||
| AuthorIdDesc
|
||||
| PrimaryKeyAsc
|
||||
| PrimaryKeyDesc
|
||||
|
||||
|
||||
list : List ProposalsOrderBy
|
||||
list =
|
||||
[ Natural, IdAsc, IdDesc, AuthorIdAsc, AuthorIdDesc, PrimaryKeyAsc, PrimaryKeyDesc ]
|
||||
|
||||
|
||||
decoder : Decoder ProposalsOrderBy
|
||||
decoder =
|
||||
Decode.string
|
||||
|> Decode.andThen
|
||||
(\string ->
|
||||
case string of
|
||||
"NATURAL" ->
|
||||
Decode.succeed Natural
|
||||
|
||||
"ID_ASC" ->
|
||||
Decode.succeed IdAsc
|
||||
|
||||
"ID_DESC" ->
|
||||
Decode.succeed IdDesc
|
||||
|
||||
"AUTHOR_ID_ASC" ->
|
||||
Decode.succeed AuthorIdAsc
|
||||
|
||||
"AUTHOR_ID_DESC" ->
|
||||
Decode.succeed AuthorIdDesc
|
||||
|
||||
"PRIMARY_KEY_ASC" ->
|
||||
Decode.succeed PrimaryKeyAsc
|
||||
|
||||
"PRIMARY_KEY_DESC" ->
|
||||
Decode.succeed PrimaryKeyDesc
|
||||
|
||||
_ ->
|
||||
Decode.fail ("Invalid ProposalsOrderBy type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ")
|
||||
)
|
||||
|
||||
|
||||
{-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize.
|
||||
-}
|
||||
toString : ProposalsOrderBy -> String
|
||||
toString enum =
|
||||
case enum of
|
||||
Natural ->
|
||||
"NATURAL"
|
||||
|
||||
IdAsc ->
|
||||
"ID_ASC"
|
||||
|
||||
IdDesc ->
|
||||
"ID_DESC"
|
||||
|
||||
AuthorIdAsc ->
|
||||
"AUTHOR_ID_ASC"
|
||||
|
||||
AuthorIdDesc ->
|
||||
"AUTHOR_ID_DESC"
|
||||
|
||||
PrimaryKeyAsc ->
|
||||
"PRIMARY_KEY_ASC"
|
||||
|
||||
PrimaryKeyDesc ->
|
||||
"PRIMARY_KEY_DESC"
|
|
@ -2,7 +2,7 @@
|
|||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.InputObject exposing (AuthenticateInput, AuthenticateInputOptionalFields, AuthenticateInputRequiredFields, RegisterInput, RegisterInputOptionalFields, RegisterInputRequiredFields, UpdateUserByIdInput, UpdateUserByIdInputOptionalFields, UpdateUserByIdInputRequiredFields, UpdateUserInput, UpdateUserInputOptionalFields, UpdateUserInputRequiredFields, UserCondition, UserConditionOptionalFields, UserPatch, UserPatchOptionalFields, buildAuthenticateInput, buildRegisterInput, buildUpdateUserByIdInput, buildUpdateUserInput, buildUserCondition, buildUserPatch, encodeAuthenticateInput, encodeRegisterInput, encodeUpdateUserByIdInput, encodeUpdateUserInput, encodeUserCondition, encodeUserPatch)
|
||||
module Api.InputObject exposing (AuthenticateInput, AuthenticateInputOptionalFields, AuthenticateInputRequiredFields, CreateProposalInput, CreateProposalInputOptionalFields, CreateProposalInputRequiredFields, ProposalCondition, ProposalConditionOptionalFields, ProposalInput, ProposalInputOptionalFields, ProposalInputRequiredFields, ProposalPatch, ProposalPatchOptionalFields, RegisterInput, RegisterInputOptionalFields, RegisterInputRequiredFields, UpdateProposalByIdInput, UpdateProposalByIdInputOptionalFields, UpdateProposalByIdInputRequiredFields, UpdateProposalInput, UpdateProposalInputOptionalFields, UpdateProposalInputRequiredFields, UpdateUserByIdInput, UpdateUserByIdInputOptionalFields, UpdateUserByIdInputRequiredFields, UpdateUserInput, UpdateUserInputOptionalFields, UpdateUserInputRequiredFields, UserCondition, UserConditionOptionalFields, UserPatch, UserPatchOptionalFields, buildAuthenticateInput, buildCreateProposalInput, buildProposalCondition, buildProposalInput, buildProposalPatch, buildRegisterInput, buildUpdateProposalByIdInput, buildUpdateProposalInput, buildUpdateUserByIdInput, buildUpdateUserInput, buildUserCondition, buildUserPatch, encodeAuthenticateInput, encodeCreateProposalInput, encodeProposalCondition, encodeProposalInput, encodeProposalPatch, encodeRegisterInput, encodeUpdateProposalByIdInput, encodeUpdateProposalInput, encodeUpdateUserByIdInput, encodeUpdateUserInput, encodeUserCondition, encodeUserPatch)
|
||||
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
|
@ -54,6 +54,168 @@ encodeAuthenticateInput input =
|
|||
[ ( "clientMutationId", Encode.string |> Encode.optional input.clientMutationId ), ( "email", Encode.string input.email |> Just ), ( "password", Encode.string input.password |> Just ) ]
|
||||
|
||||
|
||||
buildCreateProposalInput : CreateProposalInputRequiredFields -> (CreateProposalInputOptionalFields -> CreateProposalInputOptionalFields) -> CreateProposalInput
|
||||
buildCreateProposalInput required fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ clientMutationId = Absent }
|
||||
in
|
||||
{ clientMutationId = optionals.clientMutationId, proposal = required.proposal }
|
||||
|
||||
|
||||
type alias CreateProposalInputRequiredFields =
|
||||
{ proposal : ProposalInput }
|
||||
|
||||
|
||||
type alias CreateProposalInputOptionalFields =
|
||||
{ clientMutationId : OptionalArgument String }
|
||||
|
||||
|
||||
{-| Type for the CreateProposalInput input object.
|
||||
-}
|
||||
type alias CreateProposalInput =
|
||||
{ clientMutationId : OptionalArgument String
|
||||
, proposal : ProposalInput
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a CreateProposalInput into a value that can be used as an argument.
|
||||
-}
|
||||
encodeCreateProposalInput : CreateProposalInput -> Value
|
||||
encodeCreateProposalInput input =
|
||||
Encode.maybeObject
|
||||
[ ( "clientMutationId", Encode.string |> Encode.optional input.clientMutationId ), ( "proposal", encodeProposalInput input.proposal |> Just ) ]
|
||||
|
||||
|
||||
buildProposalCondition : (ProposalConditionOptionalFields -> ProposalConditionOptionalFields) -> ProposalCondition
|
||||
buildProposalCondition fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ id = Absent, authorId = Absent }
|
||||
in
|
||||
{ id = optionals.id, authorId = optionals.authorId }
|
||||
|
||||
|
||||
type alias ProposalConditionOptionalFields =
|
||||
{ id : OptionalArgument Int
|
||||
, authorId : OptionalArgument Int
|
||||
}
|
||||
|
||||
|
||||
{-| Type for the ProposalCondition input object.
|
||||
-}
|
||||
type alias ProposalCondition =
|
||||
{ id : OptionalArgument Int
|
||||
, authorId : OptionalArgument Int
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a ProposalCondition into a value that can be used as an argument.
|
||||
-}
|
||||
encodeProposalCondition : ProposalCondition -> Value
|
||||
encodeProposalCondition input =
|
||||
Encode.maybeObject
|
||||
[ ( "id", Encode.int |> Encode.optional input.id ), ( "authorId", Encode.int |> Encode.optional input.authorId ) ]
|
||||
|
||||
|
||||
buildProposalInput : ProposalInputRequiredFields -> (ProposalInputOptionalFields -> ProposalInputOptionalFields) -> ProposalInput
|
||||
buildProposalInput required fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ id = Absent, createdAt = Absent, updatedAt = Absent }
|
||||
in
|
||||
{ id = optionals.id, authorId = required.authorId, title = required.title, abstract = required.abstract, pitch = required.pitch, outline = required.outline, feedback = required.feedback, createdAt = optionals.createdAt, updatedAt = optionals.updatedAt }
|
||||
|
||||
|
||||
type alias ProposalInputRequiredFields =
|
||||
{ authorId : Int
|
||||
, title : String
|
||||
, abstract : String
|
||||
, pitch : String
|
||||
, outline : String
|
||||
, feedback : String
|
||||
}
|
||||
|
||||
|
||||
type alias ProposalInputOptionalFields =
|
||||
{ id : OptionalArgument Int
|
||||
, createdAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
, updatedAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
}
|
||||
|
||||
|
||||
{-| Type for the ProposalInput input object.
|
||||
-}
|
||||
type alias ProposalInput =
|
||||
{ id : OptionalArgument Int
|
||||
, authorId : Int
|
||||
, title : String
|
||||
, abstract : String
|
||||
, pitch : String
|
||||
, outline : String
|
||||
, feedback : String
|
||||
, createdAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
, updatedAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a ProposalInput into a value that can be used as an argument.
|
||||
-}
|
||||
encodeProposalInput : ProposalInput -> Value
|
||||
encodeProposalInput input =
|
||||
Encode.maybeObject
|
||||
[ ( "id", Encode.int |> Encode.optional input.id ), ( "authorId", Encode.int input.authorId |> Just ), ( "title", Encode.string input.title |> Just ), ( "abstract", Encode.string input.abstract |> Just ), ( "pitch", Encode.string input.pitch |> Just ), ( "outline", Encode.string input.outline |> Just ), ( "feedback", Encode.string input.feedback |> Just ), ( "createdAt", (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecDatetime) |> Encode.optional input.createdAt ), ( "updatedAt", (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecDatetime) |> Encode.optional input.updatedAt ) ]
|
||||
|
||||
|
||||
buildProposalPatch : (ProposalPatchOptionalFields -> ProposalPatchOptionalFields) -> ProposalPatch
|
||||
buildProposalPatch fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ id = Absent, authorId = Absent, title = Absent, abstract = Absent, pitch = Absent, outline = Absent, feedback = Absent, createdAt = Absent, updatedAt = Absent }
|
||||
in
|
||||
{ id = optionals.id, authorId = optionals.authorId, title = optionals.title, abstract = optionals.abstract, pitch = optionals.pitch, outline = optionals.outline, feedback = optionals.feedback, createdAt = optionals.createdAt, updatedAt = optionals.updatedAt }
|
||||
|
||||
|
||||
type alias ProposalPatchOptionalFields =
|
||||
{ id : OptionalArgument Int
|
||||
, authorId : OptionalArgument Int
|
||||
, title : OptionalArgument String
|
||||
, abstract : OptionalArgument String
|
||||
, pitch : OptionalArgument String
|
||||
, outline : OptionalArgument String
|
||||
, feedback : OptionalArgument String
|
||||
, createdAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
, updatedAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
}
|
||||
|
||||
|
||||
{-| Type for the ProposalPatch input object.
|
||||
-}
|
||||
type alias ProposalPatch =
|
||||
{ id : OptionalArgument Int
|
||||
, authorId : OptionalArgument Int
|
||||
, title : OptionalArgument String
|
||||
, abstract : OptionalArgument String
|
||||
, pitch : OptionalArgument String
|
||||
, outline : OptionalArgument String
|
||||
, feedback : OptionalArgument String
|
||||
, createdAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
, updatedAt : OptionalArgument Api.ScalarCodecs.Datetime
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a ProposalPatch into a value that can be used as an argument.
|
||||
-}
|
||||
encodeProposalPatch : ProposalPatch -> Value
|
||||
encodeProposalPatch input =
|
||||
Encode.maybeObject
|
||||
[ ( "id", Encode.int |> Encode.optional input.id ), ( "authorId", Encode.int |> Encode.optional input.authorId ), ( "title", Encode.string |> Encode.optional input.title ), ( "abstract", Encode.string |> Encode.optional input.abstract ), ( "pitch", Encode.string |> Encode.optional input.pitch ), ( "outline", Encode.string |> Encode.optional input.outline ), ( "feedback", Encode.string |> Encode.optional input.feedback ), ( "createdAt", (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecDatetime) |> Encode.optional input.createdAt ), ( "updatedAt", (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecDatetime) |> Encode.optional input.updatedAt ) ]
|
||||
|
||||
|
||||
buildRegisterInput : RegisterInputRequiredFields -> (RegisterInputOptionalFields -> RegisterInputOptionalFields) -> RegisterInput
|
||||
buildRegisterInput required fillOptionals =
|
||||
let
|
||||
|
@ -93,6 +255,80 @@ encodeRegisterInput input =
|
|||
[ ( "clientMutationId", Encode.string |> Encode.optional input.clientMutationId ), ( "name", Encode.string input.name |> Just ), ( "email", Encode.string input.email |> Just ), ( "password", Encode.string input.password |> Just ) ]
|
||||
|
||||
|
||||
buildUpdateProposalByIdInput : UpdateProposalByIdInputRequiredFields -> (UpdateProposalByIdInputOptionalFields -> UpdateProposalByIdInputOptionalFields) -> UpdateProposalByIdInput
|
||||
buildUpdateProposalByIdInput required fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ clientMutationId = Absent }
|
||||
in
|
||||
{ clientMutationId = optionals.clientMutationId, patch = required.patch, id = required.id }
|
||||
|
||||
|
||||
type alias UpdateProposalByIdInputRequiredFields =
|
||||
{ patch : ProposalPatch
|
||||
, id : Int
|
||||
}
|
||||
|
||||
|
||||
type alias UpdateProposalByIdInputOptionalFields =
|
||||
{ clientMutationId : OptionalArgument String }
|
||||
|
||||
|
||||
{-| Type for the UpdateProposalByIdInput input object.
|
||||
-}
|
||||
type alias UpdateProposalByIdInput =
|
||||
{ clientMutationId : OptionalArgument String
|
||||
, patch : ProposalPatch
|
||||
, id : Int
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a UpdateProposalByIdInput into a value that can be used as an argument.
|
||||
-}
|
||||
encodeUpdateProposalByIdInput : UpdateProposalByIdInput -> Value
|
||||
encodeUpdateProposalByIdInput input =
|
||||
Encode.maybeObject
|
||||
[ ( "clientMutationId", Encode.string |> Encode.optional input.clientMutationId ), ( "patch", encodeProposalPatch input.patch |> Just ), ( "id", Encode.int input.id |> Just ) ]
|
||||
|
||||
|
||||
buildUpdateProposalInput : UpdateProposalInputRequiredFields -> (UpdateProposalInputOptionalFields -> UpdateProposalInputOptionalFields) -> UpdateProposalInput
|
||||
buildUpdateProposalInput required fillOptionals =
|
||||
let
|
||||
optionals =
|
||||
fillOptionals
|
||||
{ clientMutationId = Absent }
|
||||
in
|
||||
{ clientMutationId = optionals.clientMutationId, nodeId = required.nodeId, patch = required.patch }
|
||||
|
||||
|
||||
type alias UpdateProposalInputRequiredFields =
|
||||
{ nodeId : Api.ScalarCodecs.Id
|
||||
, patch : ProposalPatch
|
||||
}
|
||||
|
||||
|
||||
type alias UpdateProposalInputOptionalFields =
|
||||
{ clientMutationId : OptionalArgument String }
|
||||
|
||||
|
||||
{-| Type for the UpdateProposalInput input object.
|
||||
-}
|
||||
type alias UpdateProposalInput =
|
||||
{ clientMutationId : OptionalArgument String
|
||||
, nodeId : Api.ScalarCodecs.Id
|
||||
, patch : ProposalPatch
|
||||
}
|
||||
|
||||
|
||||
{-| Encode a UpdateProposalInput into a value that can be used as an argument.
|
||||
-}
|
||||
encodeUpdateProposalInput : UpdateProposalInput -> Value
|
||||
encodeUpdateProposalInput input =
|
||||
Encode.maybeObject
|
||||
[ ( "clientMutationId", Encode.string |> Encode.optional input.clientMutationId ), ( "nodeId", (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecId) input.nodeId |> Just ), ( "patch", encodeProposalPatch input.patch |> Just ) ]
|
||||
|
||||
|
||||
buildUpdateUserByIdInput : UpdateUserByIdInputRequiredFields -> (UpdateUserByIdInputOptionalFields -> UpdateUserByIdInputOptionalFields) -> UpdateUserByIdInput
|
||||
buildUpdateUserByIdInput required fillOptionals =
|
||||
let
|
||||
|
|
|
@ -21,6 +21,7 @@ import Json.Decode as Decode
|
|||
|
||||
type alias Fragments decodesTo =
|
||||
{ onQuery : SelectionSet decodesTo RootQuery
|
||||
, onProposal : SelectionSet decodesTo Api.Object.Proposal
|
||||
, onUser : SelectionSet decodesTo Api.Object.User
|
||||
}
|
||||
|
||||
|
@ -33,6 +34,7 @@ fragments :
|
|||
fragments selections =
|
||||
Object.exhuastiveFragmentSelection
|
||||
[ Object.buildFragment "Query" selections.onQuery
|
||||
, Object.buildFragment "Proposal" selections.onProposal
|
||||
, Object.buildFragment "User" selections.onUser
|
||||
]
|
||||
|
||||
|
@ -43,6 +45,7 @@ update syntax to add `SelectionSet`s for the types you want to handle.
|
|||
maybeFragments : Fragments (Maybe decodesTo)
|
||||
maybeFragments =
|
||||
{ onQuery = Graphql.SelectionSet.empty |> Graphql.SelectionSet.map (\_ -> Nothing)
|
||||
, onProposal = Graphql.SelectionSet.empty |> Graphql.SelectionSet.map (\_ -> Nothing)
|
||||
, onUser = Graphql.SelectionSet.empty |> Graphql.SelectionSet.map (\_ -> Nothing)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Mutation exposing (AuthenticateRequiredArguments, RegisterRequiredArguments, UpdateUserByIdRequiredArguments, UpdateUserRequiredArguments, authenticate, register, updateUser, updateUserById)
|
||||
module Api.Mutation exposing (AuthenticateRequiredArguments, CreateProposalRequiredArguments, RegisterRequiredArguments, UpdateProposalByIdRequiredArguments, UpdateProposalRequiredArguments, UpdateUserByIdRequiredArguments, UpdateUserRequiredArguments, authenticate, createProposal, register, updateProposal, updateProposalById, updateUser, updateUserById)
|
||||
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
|
@ -19,6 +19,48 @@ import Graphql.SelectionSet exposing (SelectionSet)
|
|||
import Json.Decode as Decode exposing (Decoder)
|
||||
|
||||
|
||||
type alias CreateProposalRequiredArguments =
|
||||
{ input : Api.InputObject.CreateProposalInput }
|
||||
|
||||
|
||||
{-| Creates a single `Proposal`.
|
||||
|
||||
- input - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
|
||||
|
||||
-}
|
||||
createProposal : CreateProposalRequiredArguments -> SelectionSet decodesTo Api.Object.CreateProposalPayload -> SelectionSet (Maybe decodesTo) RootMutation
|
||||
createProposal requiredArgs object_ =
|
||||
Object.selectionForCompositeField "createProposal" [ Argument.required "input" requiredArgs.input Api.InputObject.encodeCreateProposalInput ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UpdateProposalRequiredArguments =
|
||||
{ input : Api.InputObject.UpdateProposalInput }
|
||||
|
||||
|
||||
{-| Updates a single `Proposal` using its globally unique id and a patch.
|
||||
|
||||
- input - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
|
||||
|
||||
-}
|
||||
updateProposal : UpdateProposalRequiredArguments -> SelectionSet decodesTo Api.Object.UpdateProposalPayload -> SelectionSet (Maybe decodesTo) RootMutation
|
||||
updateProposal requiredArgs object_ =
|
||||
Object.selectionForCompositeField "updateProposal" [ Argument.required "input" requiredArgs.input Api.InputObject.encodeUpdateProposalInput ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UpdateProposalByIdRequiredArguments =
|
||||
{ input : Api.InputObject.UpdateProposalByIdInput }
|
||||
|
||||
|
||||
{-| Updates a single `Proposal` using a unique key and a patch.
|
||||
|
||||
- input - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.
|
||||
|
||||
-}
|
||||
updateProposalById : UpdateProposalByIdRequiredArguments -> SelectionSet decodesTo Api.Object.UpdateProposalPayload -> SelectionSet (Maybe decodesTo) RootMutation
|
||||
updateProposalById requiredArgs object_ =
|
||||
Object.selectionForCompositeField "updateProposalById" [ Argument.required "input" requiredArgs.input Api.InputObject.encodeUpdateProposalByIdInput ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UpdateUserRequiredArguments =
|
||||
{ input : Api.InputObject.UpdateUserInput }
|
||||
|
||||
|
|
|
@ -2,21 +2,41 @@
|
|||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object exposing (AuthenticatePayload(..), PageInfo(..), RegisterPayload(..), UpdateUserPayload(..), User(..), UsersConnection(..), UsersEdge(..))
|
||||
module Api.Object exposing (AuthenticatePayload(..), CreateProposalPayload(..), PageInfo(..), Proposal(..), ProposalsConnection(..), ProposalsEdge(..), RegisterPayload(..), UpdateProposalPayload(..), UpdateUserPayload(..), User(..), UsersConnection(..), UsersEdge(..))
|
||||
|
||||
|
||||
type AuthenticatePayload
|
||||
= AuthenticatePayload
|
||||
|
||||
|
||||
type CreateProposalPayload
|
||||
= CreateProposalPayload
|
||||
|
||||
|
||||
type PageInfo
|
||||
= PageInfo
|
||||
|
||||
|
||||
type Proposal
|
||||
= Proposal
|
||||
|
||||
|
||||
type ProposalsConnection
|
||||
= ProposalsConnection
|
||||
|
||||
|
||||
type ProposalsEdge
|
||||
= ProposalsEdge
|
||||
|
||||
|
||||
type RegisterPayload
|
||||
= RegisterPayload
|
||||
|
||||
|
||||
type UpdateProposalPayload
|
||||
= UpdateProposalPayload
|
||||
|
||||
|
||||
type UpdateUserPayload
|
||||
= UpdateUserPayload
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.CreateProposalPayload exposing (ProposalEdgeOptionalArguments, author, clientMutationId, proposal, proposalEdge, query)
|
||||
|
||||
import Api.Enum.ProposalsOrderBy
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
import Api.Scalar
|
||||
import Api.ScalarCodecs
|
||||
import Api.Union
|
||||
import Graphql.Internal.Builder.Argument as Argument exposing (Argument)
|
||||
import Graphql.Internal.Builder.Object as Object
|
||||
import Graphql.Internal.Encode as Encode exposing (Value)
|
||||
import Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)
|
||||
import Graphql.OptionalArgument exposing (OptionalArgument(..))
|
||||
import Graphql.SelectionSet exposing (SelectionSet)
|
||||
import Json.Decode as Decode
|
||||
|
||||
|
||||
{-| The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations.
|
||||
-}
|
||||
clientMutationId : SelectionSet (Maybe String) Api.Object.CreateProposalPayload
|
||||
clientMutationId =
|
||||
Object.selectionForField "(Maybe String)" "clientMutationId" [] (Decode.string |> Decode.nullable)
|
||||
|
||||
|
||||
{-| The `Proposal` that was created by this mutation.
|
||||
-}
|
||||
proposal : SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (Maybe decodesTo) Api.Object.CreateProposalPayload
|
||||
proposal object_ =
|
||||
Object.selectionForCompositeField "proposal" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
{-| Our root query field type. Allows us to run any query from our mutation payload.
|
||||
-}
|
||||
query : SelectionSet decodesTo RootQuery -> SelectionSet (Maybe decodesTo) Api.Object.CreateProposalPayload
|
||||
query object_ =
|
||||
Object.selectionForCompositeField "query" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
{-| Reads a single `User` that is related to this `Proposal`.
|
||||
-}
|
||||
author : SelectionSet decodesTo Api.Object.User -> SelectionSet (Maybe decodesTo) Api.Object.CreateProposalPayload
|
||||
author object_ =
|
||||
Object.selectionForCompositeField "author" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias ProposalEdgeOptionalArguments =
|
||||
{ orderBy : OptionalArgument (List Api.Enum.ProposalsOrderBy.ProposalsOrderBy) }
|
||||
|
||||
|
||||
{-| An edge for our `Proposal`. May be used by Relay 1.
|
||||
|
||||
- orderBy - The method to use when ordering `Proposal`.
|
||||
|
||||
-}
|
||||
proposalEdge : (ProposalEdgeOptionalArguments -> ProposalEdgeOptionalArguments) -> SelectionSet decodesTo Api.Object.ProposalsEdge -> SelectionSet (Maybe decodesTo) Api.Object.CreateProposalPayload
|
||||
proposalEdge fillInOptionals object_ =
|
||||
let
|
||||
filledInOptionals =
|
||||
fillInOptionals { orderBy = Absent }
|
||||
|
||||
optionalArgs =
|
||||
[ Argument.optional "orderBy" filledInOptionals.orderBy (Encode.enum Api.Enum.ProposalsOrderBy.toString |> Encode.list) ]
|
||||
|> List.filterMap identity
|
||||
in
|
||||
Object.selectionForCompositeField "proposalEdge" optionalArgs object_ (identity >> Decode.nullable)
|
|
@ -0,0 +1,78 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.Proposal exposing (abstract, author, authorId, createdAt, feedback, id, nodeId, outline, pitch, title, updatedAt)
|
||||
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
import Api.Scalar
|
||||
import Api.ScalarCodecs
|
||||
import Api.Union
|
||||
import Graphql.Internal.Builder.Argument as Argument exposing (Argument)
|
||||
import Graphql.Internal.Builder.Object as Object
|
||||
import Graphql.Internal.Encode as Encode exposing (Value)
|
||||
import Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)
|
||||
import Graphql.OptionalArgument exposing (OptionalArgument(..))
|
||||
import Graphql.SelectionSet exposing (SelectionSet)
|
||||
import Json.Decode as Decode
|
||||
|
||||
|
||||
{-| A globally unique identifier. Can be used in various places throughout the system to identify this single value.
|
||||
-}
|
||||
nodeId : SelectionSet Api.ScalarCodecs.Id Api.Object.Proposal
|
||||
nodeId =
|
||||
Object.selectionForField "ScalarCodecs.Id" "nodeId" [] (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapCodecs |> .codecId |> .decoder)
|
||||
|
||||
|
||||
id : SelectionSet Int Api.Object.Proposal
|
||||
id =
|
||||
Object.selectionForField "Int" "id" [] Decode.int
|
||||
|
||||
|
||||
authorId : SelectionSet Int Api.Object.Proposal
|
||||
authorId =
|
||||
Object.selectionForField "Int" "authorId" [] Decode.int
|
||||
|
||||
|
||||
title : SelectionSet String Api.Object.Proposal
|
||||
title =
|
||||
Object.selectionForField "String" "title" [] Decode.string
|
||||
|
||||
|
||||
abstract : SelectionSet String Api.Object.Proposal
|
||||
abstract =
|
||||
Object.selectionForField "String" "abstract" [] Decode.string
|
||||
|
||||
|
||||
pitch : SelectionSet String Api.Object.Proposal
|
||||
pitch =
|
||||
Object.selectionForField "String" "pitch" [] Decode.string
|
||||
|
||||
|
||||
outline : SelectionSet String Api.Object.Proposal
|
||||
outline =
|
||||
Object.selectionForField "String" "outline" [] Decode.string
|
||||
|
||||
|
||||
feedback : SelectionSet String Api.Object.Proposal
|
||||
feedback =
|
||||
Object.selectionForField "String" "feedback" [] Decode.string
|
||||
|
||||
|
||||
createdAt : SelectionSet Api.ScalarCodecs.Datetime Api.Object.Proposal
|
||||
createdAt =
|
||||
Object.selectionForField "ScalarCodecs.Datetime" "createdAt" [] (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapCodecs |> .codecDatetime |> .decoder)
|
||||
|
||||
|
||||
updatedAt : SelectionSet Api.ScalarCodecs.Datetime Api.Object.Proposal
|
||||
updatedAt =
|
||||
Object.selectionForField "ScalarCodecs.Datetime" "updatedAt" [] (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapCodecs |> .codecDatetime |> .decoder)
|
||||
|
||||
|
||||
{-| Reads a single `User` that is related to this `Proposal`.
|
||||
-}
|
||||
author : SelectionSet decodesTo Api.Object.User -> SelectionSet (Maybe decodesTo) Api.Object.Proposal
|
||||
author object_ =
|
||||
Object.selectionForCompositeField "author" [] object_ (identity >> Decode.nullable)
|
|
@ -0,0 +1,47 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.ProposalsConnection exposing (edges, nodes, pageInfo, totalCount)
|
||||
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
import Api.Scalar
|
||||
import Api.ScalarCodecs
|
||||
import Api.Union
|
||||
import Graphql.Internal.Builder.Argument as Argument exposing (Argument)
|
||||
import Graphql.Internal.Builder.Object as Object
|
||||
import Graphql.Internal.Encode as Encode exposing (Value)
|
||||
import Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)
|
||||
import Graphql.OptionalArgument exposing (OptionalArgument(..))
|
||||
import Graphql.SelectionSet exposing (SelectionSet)
|
||||
import Json.Decode as Decode
|
||||
|
||||
|
||||
{-| A list of `Proposal` objects.
|
||||
-}
|
||||
nodes : SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (List (Maybe decodesTo)) Api.Object.ProposalsConnection
|
||||
nodes object_ =
|
||||
Object.selectionForCompositeField "nodes" [] object_ (identity >> Decode.nullable >> Decode.list)
|
||||
|
||||
|
||||
{-| A list of edges which contains the `Proposal` and cursor to aid in pagination.
|
||||
-}
|
||||
edges : SelectionSet decodesTo Api.Object.ProposalsEdge -> SelectionSet (List decodesTo) Api.Object.ProposalsConnection
|
||||
edges object_ =
|
||||
Object.selectionForCompositeField "edges" [] object_ (identity >> Decode.list)
|
||||
|
||||
|
||||
{-| Information to aid in pagination.
|
||||
-}
|
||||
pageInfo : SelectionSet decodesTo Api.Object.PageInfo -> SelectionSet decodesTo Api.Object.ProposalsConnection
|
||||
pageInfo object_ =
|
||||
Object.selectionForCompositeField "pageInfo" [] object_ identity
|
||||
|
||||
|
||||
{-| The count of _all_ `Proposal` you could get from the connection.
|
||||
-}
|
||||
totalCount : SelectionSet (Maybe Int) Api.Object.ProposalsConnection
|
||||
totalCount =
|
||||
Object.selectionForField "(Maybe Int)" "totalCount" [] (Decode.int |> Decode.nullable)
|
|
@ -0,0 +1,33 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.ProposalsEdge exposing (cursor, node)
|
||||
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
import Api.Scalar
|
||||
import Api.ScalarCodecs
|
||||
import Api.Union
|
||||
import Graphql.Internal.Builder.Argument as Argument exposing (Argument)
|
||||
import Graphql.Internal.Builder.Object as Object
|
||||
import Graphql.Internal.Encode as Encode exposing (Value)
|
||||
import Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)
|
||||
import Graphql.OptionalArgument exposing (OptionalArgument(..))
|
||||
import Graphql.SelectionSet exposing (SelectionSet)
|
||||
import Json.Decode as Decode
|
||||
|
||||
|
||||
{-| A cursor for use in pagination.
|
||||
-}
|
||||
cursor : SelectionSet (Maybe Api.ScalarCodecs.Cursor) Api.Object.ProposalsEdge
|
||||
cursor =
|
||||
Object.selectionForField "(Maybe ScalarCodecs.Cursor)" "cursor" [] (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapCodecs |> .codecCursor |> .decoder |> Decode.nullable)
|
||||
|
||||
|
||||
{-| The `Proposal` at the end of the edge.
|
||||
-}
|
||||
node : SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (Maybe decodesTo) Api.Object.ProposalsEdge
|
||||
node object_ =
|
||||
Object.selectionForCompositeField "node" [] object_ (identity >> Decode.nullable)
|
|
@ -0,0 +1,70 @@
|
|||
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
|
||||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.UpdateProposalPayload exposing (ProposalEdgeOptionalArguments, author, clientMutationId, proposal, proposalEdge, query)
|
||||
|
||||
import Api.Enum.ProposalsOrderBy
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
import Api.Scalar
|
||||
import Api.ScalarCodecs
|
||||
import Api.Union
|
||||
import Graphql.Internal.Builder.Argument as Argument exposing (Argument)
|
||||
import Graphql.Internal.Builder.Object as Object
|
||||
import Graphql.Internal.Encode as Encode exposing (Value)
|
||||
import Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)
|
||||
import Graphql.OptionalArgument exposing (OptionalArgument(..))
|
||||
import Graphql.SelectionSet exposing (SelectionSet)
|
||||
import Json.Decode as Decode
|
||||
|
||||
|
||||
{-| The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations.
|
||||
-}
|
||||
clientMutationId : SelectionSet (Maybe String) Api.Object.UpdateProposalPayload
|
||||
clientMutationId =
|
||||
Object.selectionForField "(Maybe String)" "clientMutationId" [] (Decode.string |> Decode.nullable)
|
||||
|
||||
|
||||
{-| The `Proposal` that was updated by this mutation.
|
||||
-}
|
||||
proposal : SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (Maybe decodesTo) Api.Object.UpdateProposalPayload
|
||||
proposal object_ =
|
||||
Object.selectionForCompositeField "proposal" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
{-| Our root query field type. Allows us to run any query from our mutation payload.
|
||||
-}
|
||||
query : SelectionSet decodesTo RootQuery -> SelectionSet (Maybe decodesTo) Api.Object.UpdateProposalPayload
|
||||
query object_ =
|
||||
Object.selectionForCompositeField "query" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
{-| Reads a single `User` that is related to this `Proposal`.
|
||||
-}
|
||||
author : SelectionSet decodesTo Api.Object.User -> SelectionSet (Maybe decodesTo) Api.Object.UpdateProposalPayload
|
||||
author object_ =
|
||||
Object.selectionForCompositeField "author" [] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias ProposalEdgeOptionalArguments =
|
||||
{ orderBy : OptionalArgument (List Api.Enum.ProposalsOrderBy.ProposalsOrderBy) }
|
||||
|
||||
|
||||
{-| An edge for our `Proposal`. May be used by Relay 1.
|
||||
|
||||
- orderBy - The method to use when ordering `Proposal`.
|
||||
|
||||
-}
|
||||
proposalEdge : (ProposalEdgeOptionalArguments -> ProposalEdgeOptionalArguments) -> SelectionSet decodesTo Api.Object.ProposalsEdge -> SelectionSet (Maybe decodesTo) Api.Object.UpdateProposalPayload
|
||||
proposalEdge fillInOptionals object_ =
|
||||
let
|
||||
filledInOptionals =
|
||||
fillInOptionals { orderBy = Absent }
|
||||
|
||||
optionalArgs =
|
||||
[ Argument.optional "orderBy" filledInOptionals.orderBy (Encode.enum Api.Enum.ProposalsOrderBy.toString |> Encode.list) ]
|
||||
|> List.filterMap identity
|
||||
in
|
||||
Object.selectionForCompositeField "proposalEdge" optionalArgs object_ (identity >> Decode.nullable)
|
|
@ -2,8 +2,9 @@
|
|||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Object.User exposing (createdAt, firstTimeSpeaker, id, isReviewer, name, nodeId, speakerUnderrepresented, updatedAt)
|
||||
module Api.Object.User exposing (AuthoredProposalsOptionalArguments, authoredProposals, createdAt, firstTimeSpeaker, id, isReviewer, name, nodeId, speakerUnderrepresented, updatedAt)
|
||||
|
||||
import Api.Enum.ProposalsOrderBy
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
import Api.Object
|
||||
|
@ -59,3 +60,38 @@ createdAt =
|
|||
updatedAt : SelectionSet Api.ScalarCodecs.Datetime Api.Object.User
|
||||
updatedAt =
|
||||
Object.selectionForField "ScalarCodecs.Datetime" "updatedAt" [] (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapCodecs |> .codecDatetime |> .decoder)
|
||||
|
||||
|
||||
type alias AuthoredProposalsOptionalArguments =
|
||||
{ first : OptionalArgument Int
|
||||
, last : OptionalArgument Int
|
||||
, offset : OptionalArgument Int
|
||||
, before : OptionalArgument Api.ScalarCodecs.Cursor
|
||||
, after : OptionalArgument Api.ScalarCodecs.Cursor
|
||||
, orderBy : OptionalArgument (List Api.Enum.ProposalsOrderBy.ProposalsOrderBy)
|
||||
, condition : OptionalArgument Api.InputObject.ProposalCondition
|
||||
}
|
||||
|
||||
|
||||
{-| Reads and enables pagination through a set of `Proposal`.
|
||||
|
||||
- first - Only read the first `n` values of the set.
|
||||
- last - Only read the last `n` values of the set.
|
||||
- offset - Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`.
|
||||
- before - Read all values in the set before (above) this cursor.
|
||||
- after - Read all values in the set after (below) this cursor.
|
||||
- orderBy - The method to use when ordering `Proposal`.
|
||||
- condition - A condition to be used in determining which values should be returned by the collection.
|
||||
|
||||
-}
|
||||
authoredProposals : (AuthoredProposalsOptionalArguments -> AuthoredProposalsOptionalArguments) -> SelectionSet decodesTo Api.Object.ProposalsConnection -> SelectionSet decodesTo Api.Object.User
|
||||
authoredProposals fillInOptionals object_ =
|
||||
let
|
||||
filledInOptionals =
|
||||
fillInOptionals { first = Absent, last = Absent, offset = Absent, before = Absent, after = Absent, orderBy = Absent, condition = Absent }
|
||||
|
||||
optionalArgs =
|
||||
[ Argument.optional "first" filledInOptionals.first Encode.int, Argument.optional "last" filledInOptionals.last Encode.int, Argument.optional "offset" filledInOptionals.offset Encode.int, Argument.optional "before" filledInOptionals.before (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecCursor), Argument.optional "after" filledInOptionals.after (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecCursor), Argument.optional "orderBy" filledInOptionals.orderBy (Encode.enum Api.Enum.ProposalsOrderBy.toString |> Encode.list), Argument.optional "condition" filledInOptionals.condition Api.InputObject.encodeProposalCondition ]
|
||||
|> List.filterMap identity
|
||||
in
|
||||
Object.selectionForCompositeField "authoredProposals" optionalArgs object_ identity
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
-- https://github.com/dillonkearns/elm-graphql
|
||||
|
||||
|
||||
module Api.Query exposing (NodeRequiredArguments, UserByIdRequiredArguments, UserRequiredArguments, UsersOptionalArguments, node, nodeId, query, user, userById, users)
|
||||
module Api.Query exposing (NodeRequiredArguments, ProposalByIdRequiredArguments, ProposalRequiredArguments, ProposalsOptionalArguments, UserByIdRequiredArguments, UserRequiredArguments, UsersOptionalArguments, node, nodeId, proposal, proposalById, proposals, query, user, userById, users)
|
||||
|
||||
import Api.Enum.ProposalsOrderBy
|
||||
import Api.Enum.UsersOrderBy
|
||||
import Api.InputObject
|
||||
import Api.Interface
|
||||
|
@ -48,6 +49,41 @@ node requiredArgs object_ =
|
|||
Object.selectionForCompositeField "node" [ Argument.required "nodeId" requiredArgs.nodeId (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecId) ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias ProposalsOptionalArguments =
|
||||
{ first : OptionalArgument Int
|
||||
, last : OptionalArgument Int
|
||||
, offset : OptionalArgument Int
|
||||
, before : OptionalArgument Api.ScalarCodecs.Cursor
|
||||
, after : OptionalArgument Api.ScalarCodecs.Cursor
|
||||
, orderBy : OptionalArgument (List Api.Enum.ProposalsOrderBy.ProposalsOrderBy)
|
||||
, condition : OptionalArgument Api.InputObject.ProposalCondition
|
||||
}
|
||||
|
||||
|
||||
{-| Reads and enables pagination through a set of `Proposal`.
|
||||
|
||||
- first - Only read the first `n` values of the set.
|
||||
- last - Only read the last `n` values of the set.
|
||||
- offset - Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`.
|
||||
- before - Read all values in the set before (above) this cursor.
|
||||
- after - Read all values in the set after (below) this cursor.
|
||||
- orderBy - The method to use when ordering `Proposal`.
|
||||
- condition - A condition to be used in determining which values should be returned by the collection.
|
||||
|
||||
-}
|
||||
proposals : (ProposalsOptionalArguments -> ProposalsOptionalArguments) -> SelectionSet decodesTo Api.Object.ProposalsConnection -> SelectionSet (Maybe decodesTo) RootQuery
|
||||
proposals fillInOptionals object_ =
|
||||
let
|
||||
filledInOptionals =
|
||||
fillInOptionals { first = Absent, last = Absent, offset = Absent, before = Absent, after = Absent, orderBy = Absent, condition = Absent }
|
||||
|
||||
optionalArgs =
|
||||
[ Argument.optional "first" filledInOptionals.first Encode.int, Argument.optional "last" filledInOptionals.last Encode.int, Argument.optional "offset" filledInOptionals.offset Encode.int, Argument.optional "before" filledInOptionals.before (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecCursor), Argument.optional "after" filledInOptionals.after (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecCursor), Argument.optional "orderBy" filledInOptionals.orderBy (Encode.enum Api.Enum.ProposalsOrderBy.toString |> Encode.list), Argument.optional "condition" filledInOptionals.condition Api.InputObject.encodeProposalCondition ]
|
||||
|> List.filterMap identity
|
||||
in
|
||||
Object.selectionForCompositeField "proposals" optionalArgs object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UsersOptionalArguments =
|
||||
{ first : OptionalArgument Int
|
||||
, last : OptionalArgument Int
|
||||
|
@ -83,6 +119,15 @@ users fillInOptionals object_ =
|
|||
Object.selectionForCompositeField "users" optionalArgs object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias ProposalByIdRequiredArguments =
|
||||
{ id : Int }
|
||||
|
||||
|
||||
proposalById : ProposalByIdRequiredArguments -> SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (Maybe decodesTo) RootQuery
|
||||
proposalById requiredArgs object_ =
|
||||
Object.selectionForCompositeField "proposalById" [ Argument.required "id" requiredArgs.id Encode.int ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UserByIdRequiredArguments =
|
||||
{ id : Int }
|
||||
|
||||
|
@ -92,6 +137,20 @@ userById requiredArgs object_ =
|
|||
Object.selectionForCompositeField "userById" [ Argument.required "id" requiredArgs.id Encode.int ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias ProposalRequiredArguments =
|
||||
{ nodeId : Api.ScalarCodecs.Id }
|
||||
|
||||
|
||||
{-| Reads a single `Proposal` using its globally unique `ID`.
|
||||
|
||||
- nodeId - The globally unique `ID` to be used in selecting a single `Proposal`.
|
||||
|
||||
-}
|
||||
proposal : ProposalRequiredArguments -> SelectionSet decodesTo Api.Object.Proposal -> SelectionSet (Maybe decodesTo) RootQuery
|
||||
proposal requiredArgs object_ =
|
||||
Object.selectionForCompositeField "proposal" [ Argument.required "nodeId" requiredArgs.nodeId (Api.ScalarCodecs.codecs |> Api.Scalar.unwrapEncoder .codecId) ] object_ (identity >> Decode.nullable)
|
||||
|
||||
|
||||
type alias UserRequiredArguments =
|
||||
{ nodeId : Api.ScalarCodecs.Id }
|
||||
|
||||
|
|
Loading…
Reference in New Issue