Tune cache control

This commit is contained in:
Douglas Barone 2021-11-17 12:17:56 -04:00
parent 62f94781d3
commit 75bb8fa0d6

View File

@ -3,7 +3,7 @@ import { gql } from 'apollo-server'
const typeDefs = gql` const typeDefs = gql`
type Query { type Query {
"Returns only a few fields of a user" "Returns only a few fields of a user"
basicUser(sAMAccountName: String!): User! @cacheControl(maxAge: 350) basicUser(sAMAccountName: String!): User! @cacheControl(maxAge: 10)
"The authenticated user" "The authenticated user"
me: User! @auth me: User! @auth
@ -15,20 +15,20 @@ const typeDefs = gql`
limit: Int = 15 limit: Int = 15
"Should return only students?" "Should return only students?"
onlyStudents: Boolean = false onlyStudents: Boolean = false
): [User!] @auth(roles: ["servant"]) @cacheControl(maxAge: 350) ): [User!] @auth(roles: ["servant"]) @cacheControl(maxAge: 10)
"A single user" "A single user"
user(sAMAccountName: String!): User! user(sAMAccountName: String!): User!
@auth(roles: ["superAdmin"]) @auth(roles: ["superAdmin"])
@cacheControl(maxAge: 350) @cacheControl(maxAge: 10)
"AD groups" "AD groups"
groups(where: GroupWhereInput!, limit: Int = 10): [Group!]! groups(where: GroupWhereInput!, limit: Int = 10): [Group!]!
@auth(roles: ["servant"]) @auth(roles: ["servant"])
@cacheControl(maxAge: 350) @cacheControl(maxAge: 10)
"Current stats. Differs from the historical statistics." "Current stats. Differs from the historical statistics."
stats: Stats! @cacheControl(maxAge: 30) stats: Stats!
"Users who has some device currently connected to Wi-Fi" "Users who has some device currently connected to Wi-Fi"
userPresence(search: String = ""): [UserPresence!] @auth(roles: ["watcher"]) userPresence(search: String = ""): [UserPresence!] @auth(roles: ["watcher"])
@ -38,14 +38,10 @@ const typeDefs = gql`
search: String = "" search: String = ""
identifiedOnly: Boolean = false identifiedOnly: Boolean = false
nonIdentifiedOnly: Boolean = false nonIdentifiedOnly: Boolean = false
): [WifiDevice]! ): [WifiDevice]! @auth(roles: ["superAdmin"])
@cacheControl(maxAge: 10, scope: PRIVATE)
@auth(roles: ["superAdmin"])
"Users that uses the Wi-Fi" "Users that uses the Wi-Fi"
wifiUsers: [User]! wifiUsers: [User]! @auth(roles: ["superAdmin"])
@auth(roles: ["superAdmin"])
@cacheControl(maxAge: 10, scope: PRIVATE)
"Application Logs" "Application Logs"
logs( logs(
@ -53,9 +49,7 @@ const typeDefs = gql`
dateIn: String dateIn: String
dateOut: String dateOut: String
limit: Int = 200 limit: Int = 200
): [Log]! ): [Log]! @auth(roles: ["superAdmin"])
@auth(roles: ["superAdmin"])
@cacheControl(maxAge: 2, scope: PRIVATE)
pAHosts: [PAHost!]! @auth(roles: ["superAdmin"]) pAHosts: [PAHost!]! @auth(roles: ["superAdmin"])
} }