Make dateIn optional
This commit is contained in:
parent
b69a951b05
commit
734032186c
|
@ -8,7 +8,7 @@ export async function logs(parent, { search, dateIn, dateOut, limit }) {
|
|||
const logs = await prisma.log.findMany({
|
||||
where: {
|
||||
timestamp: {
|
||||
gte: new Date(dateIn),
|
||||
gte: dateIn ? new Date(dateIn) : undefined,
|
||||
lte: new Date(dateOut)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -50,7 +50,7 @@ const typeDefs = gql`
|
|||
"Application Logs"
|
||||
logs(
|
||||
search: String = ""
|
||||
dateIn: String!
|
||||
dateIn: String
|
||||
dateOut: String
|
||||
limit: Int = 200
|
||||
): [Log]!
|
||||
|
|
|
@ -92,7 +92,7 @@ import VueJsonPretty from 'vue-json-pretty'
|
|||
import 'vue-json-pretty/lib/styles.css'
|
||||
|
||||
const LOGS_QUERY = gql`
|
||||
query($search: String, $dateIn: String!, $dateOut: String, $limit: Int) {
|
||||
query($search: String, $dateIn: String, $dateOut: String, $limit: Int) {
|
||||
logs(search: $search, dateIn: $dateIn, dateOut: $dateOut, limit: $limit) {
|
||||
id
|
||||
timestamp
|
||||
|
@ -114,7 +114,7 @@ export default {
|
|||
showSuccess: true,
|
||||
|
||||
search: '',
|
||||
dateIn: new Date(),
|
||||
dateIn: null,
|
||||
dateOut: null,
|
||||
limit: 100,
|
||||
|
||||
|
@ -174,9 +174,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
this.dateIn = subDays(new Date(), 5).toISOString().substr(0, 10)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user