I have implemented schema for fetching activities from the system and is working perfortly on fetching the whole list. I want to start passing user_id so as to filter based on the user or to filter by top 10 last week activities. My schema is;
The schema for activity.graphql
type ActivityActivity {
id: ID!
activity: String!
user: User @belongsTo
created_at: String!
updated_at: String
deleted_at: String
createdBy: User @belongsTo
updatedBy: User @belongsTo
deletedBy: User @belongsTo
}
extend type Mutation {
createActivityActivity(
id: ID
activity: String!
user_id: Int!
source_type: String!
source_id: Int!
): ActivityActivity @create(model: "Modules\\Activity\\Entities\\Activity")
updateActivityActivity(
id: ID!
activity: String
user_id: Int
source_type: String
source_id: Int
): ActivityActivity @update(model: "Modules\\Activity\\Entities\\Activity")
deleteActivityActivity(id: [ID!]!): [ActivityActivity!]! @delete(model: "Modules\\Activity\\Entities\\Activity")
}
extend type Query {
activity_activity: [ActivityActivity!]! @paginate(model: "Modules\\Activity\\Entities\\Activity")
find_activity_activity(id: Int! @eq): ActivityActivity @find(model: "Modules\\Activity\\Entities\\Activity")
}
extend type User {
activity: [ActivityActivity!]! @hasMany
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire