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