Make field names camelCase

This commit is contained in:
Deluan 2020-05-08 10:47:06 -04:00 committed by Deluan Quintão
parent fec589dce5
commit 5afcd0ad22
2 changed files with 27 additions and 15 deletions

View file

@ -3,15 +3,15 @@ package model
import "time" import "time"
type Playlist struct { type Playlist struct {
ID string ID string `json:"id"`
Name string Name string `json:"name"`
Comment string Comment string `json:"comment"`
Duration float32 Duration float32 `json:"duration"`
Owner string Owner string `json:"owner"`
Public bool Public bool `json:"public"`
Tracks MediaFiles Tracks MediaFiles `json:"tracks"`
CreatedAt time.Time CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time UpdatedAt time.Time `json:"updatedAt"`
} }
type PlaylistRepository interface { type PlaylistRepository interface {

View file

@ -1,5 +1,12 @@
import React from 'react' import React from 'react'
import { List, Datagrid, TextField, BooleanField, DateField } from 'react-admin' import {
List,
Datagrid,
TextField,
BooleanField,
FunctionField,
DateField,
} from 'react-admin'
import { DurationField, Title } from '../common' import { DurationField, Title } from '../common'
const PlaylistList = (props) => ( const PlaylistList = (props) => (
@ -11,11 +18,16 @@ const PlaylistList = (props) => (
exporter={false} exporter={false}
> >
<Datagrid rowClick="edit"> <Datagrid rowClick="edit">
<TextField source="Name" /> <TextField source="name" />
<TextField source="Owner" /> <TextField source="owner" />
<BooleanField source="Public" /> <BooleanField source="public" />
<DateField source="UpdatedAt" /> <FunctionField
<DurationField source="Duration" /> sortable={false} // TODO Make playlist.songCount sortable
source="songCount"
render={(r) => r.tracks && r.tracks.length}
/>
<DurationField source="duration" />
<DateField source="updatedAt" />
</Datagrid> </Datagrid>
</List> </List>
) )