File tree Expand file tree Collapse file tree 4 files changed +53
-0
lines changed
src/queries/trouble-tickets Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as TE from 'fp-ts/TaskEither' ;
2+ import { FailureWithStatus } from '../../types/failure-with-status' ;
3+ import { ViewModel } from './view-model' ;
4+ import { User } from '../../types' ;
5+ import { UUID } from 'io-ts-types' ;
6+ import { SharedReadModel } from '../../read-models/shared-state' ;
7+
8+ export const constructViewModel =
9+ ( readModel : SharedReadModel ) =>
10+ ( user : User ) : TE . TaskEither < FailureWithStatus , ViewModel > => {
11+
12+ } ;
Original file line number Diff line number Diff line change 1+ import { pipe } from 'fp-ts/lib/function' ;
2+ import * as TE from 'fp-ts/TaskEither' ;
3+ import { constructViewModel } from './construct-view-model' ;
4+ import { render } from './render' ;
5+ import { Query } from '../query' ;
6+ import { safe , toLoggedInContent } from '../../types/html' ;
7+
8+ export const troubleTickets : Query = deps => user =>
9+ pipe (
10+ user ,
11+ constructViewModel ( deps . sharedReadModel ) ,
12+ TE . map ( render ) ,
13+ TE . map ( toLoggedInContent ( safe ( 'Trouble Tickets' ) ) )
14+ ) ;
Original file line number Diff line number Diff line change 1+ import { pipe } from 'fp-ts/lib/function' ;
2+ import { html } from '../../types/html' ;
3+ import { ViewModel } from './view-model' ;
4+
5+ export const render = ( viewModel : ViewModel ) =>
6+ pipe (
7+ viewModel ,
8+ ( _viewModel : ViewModel ) => html `
9+ < div class ="stack ">
10+ < h1 > Trouble tickets</ h1 >
11+ </ div >
12+ `
13+ ) ;
Original file line number Diff line number Diff line change 1+ import { DateTime } from 'luxon' ;
2+ import * as O from 'fp-ts/Option' ;
3+
4+ export type ViewModel = {
5+ isSuperUser : boolean ;
6+ troubleTicketData : ReadonlyArray < {
7+ responseSubmitted : DateTime ;
8+ emailAddress : O . Option < string > ;
9+ whichEquipment : O . Option < string > ;
10+ submitterName : O . Option < string > ;
11+ submitterMembershipNumber : O . Option < number > ;
12+ submittedResponse : Record < string , string > ;
13+ } > ;
14+ } ;
You can’t perform that action at this time.
0 commit comments