Skip to content

Instantly share code, notes, and snippets.

View xperiandri's full-sized avatar

Andrii Chebukin xperiandri

View GitHub Profile
let asyncGetGrupo (ctx : ResolveFieldContext) _ = asyncResult {
let container = ctx.Root.BibliotekoDatabase.GrupojContainer
let! grupoId = ctx.ArgId
return! asyncGetGrupo container grupoId |> AsyncResult.mapError ErrorMappings.mapGrupoError
}
public Task<Grupo> GetGrupoAsync(ResolveFieldContext: ctx, Root: _)
{
var cointainer = ctx.Root.BibliotekoDatabase.GrupojContainer;
let InputRegistriCultureType =
Define.InputObject<RegistriCulture>
(name = "InputCulture",
fields =
[ Define.Input ("kind" , String , description = "A kind of book culture: native or translated")
Define.Input ("culture", CultureInfoType, description = "A culture code of a book") ])
// C#
// Define.Input (name: "kind", type: String, defaultValue: null, description: "A kind of book culture: native or translated")
// static var Mutation = Define.Object<Root>(...)
let Mutation =
Define.Object<Root> (
...
fields = [ Define.AsyncField (
...
inputs = [ Define.Input ("command", SetCommentInputType) ],
...) ])
// static var Query = Define.Object<Root>(...)
let Query =
Define.Object<Root>
(name = "Query",
fields = [ Define.AsyncField (
name = "grupoj",
type = ListOf GrupoType,
resolver = asyncGetRecenzoj) ])
type Root (serviceProvider : IServiceProvider,
user : Lazy<Result<GraphQLUser, ErrorMessage>>,
facebookService : Lazy<Result<IFacebookService, ErrorMessage>>,
securityOptions : IOptions<SecurityOptions>) =
let securityOptions = securityOptions.Value
member val RequestId = System.Guid.NewGuid () with get
type Reaction = enum Reaction
{
| Undefined = 0 Undefined = 0,
| Cool = 1 Cool = 1,
| LoveIt = 2 LoveIt = 2,
| Boring = 3 Boring = 3,
| Gripping = 4 Gripping = 4,
| Sad = 5 Sad = 5,
| Inspiring = 6 Inspiring = 6