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"
type Playlist struct {
ID string
Name string
Comment string
Duration float32
Owner string
Public bool
Tracks MediaFiles
CreatedAt time.Time
UpdatedAt time.Time
ID string `json:"id"`
Name string `json:"name"`
Comment string `json:"comment"`
Duration float32 `json:"duration"`
Owner string `json:"owner"`
Public bool `json:"public"`
Tracks MediaFiles `json:"tracks"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type PlaylistRepository interface {

View file

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