|
| 1 | +Your task is to create a simplified Resources and Operations (R&O) representation of a specified piece of source code. The objective is to abstract the code into high-level resources and operations to furnish a clear, structured overview of the code's primary entities and functionalities, bypassing the need for detailed syntax or token-level analysis. |
| 2 | + |
| 3 | +Definitions: |
| 4 | + |
| 5 | +- A "Resource" refers to crucial structures, entities, or data types within the code. |
| 6 | +- An "Operation" refers to significant actions, functions, or methods executed within the code. |
| 7 | + |
| 8 | +Guidelines for R&O Representation: |
| 9 | + |
| 10 | +1. Resources Identification: |
| 11 | + a. Library Imports: List the primary libraries or modules being imported. |
| 12 | + b. Input Filters: Catalog input structures or filters. |
| 13 | + c. Main Object: Identify the principal object, struct, or class. |
| 14 | + |
| 15 | +2. Operations Identification: |
| 16 | + a. Under the main object, struct, or class, list the associated operations. |
| 17 | + b. For each operation, provide a brief description of the primary action being executed. |
| 18 | + |
| 19 | +3. Structuring: |
| 20 | + a. Utilize a hierarchical, indented format to depict dependencies or relationships clearly. |
| 21 | + b. Ensure consistency in the representation to allow for a standardized, concise output given a standard input. |
| 22 | + |
| 23 | +4. Conciseness and Abstraction: |
| 24 | + a. Maintain focus on high-level abstractions, avoiding detailed syntax or token-level analysis. |
| 25 | + b. Keep the representation succinct, ensuring it is easily understandable and directly reflective of the code's structure and functionality. |
| 26 | + |
| 27 | +Example of use: |
| 28 | + |
| 29 | +input: |
| 30 | + |
| 31 | +- path: /Users/bregy/Documents/minskylab/plexo-core/src/graphql/queries/resources.rs |
| 32 | +- source: |
| 33 | + |
| 34 | + - ```rust |
| 35 | + use std::str::FromStr; |
| 36 | + |
| 37 | + use async_graphql::{Context, InputObject, Object, Result}; |
| 38 | + use chrono::{DateTime, Utc}; |
| 39 | + use uuid::Uuid; |
| 40 | + |
| 41 | + use crate::{ |
| 42 | + graphql::auth::extract_context, |
| 43 | + sdk::{ |
| 44 | + activity::{Activity, ActivityOperationType, ActivityResourceType}, |
| 45 | + labels::Label, |
| 46 | + member::{Member, MemberRole}, |
| 47 | + project::Project, |
| 48 | + task::{Task, TaskPriority, TaskStatus}, |
| 49 | + team::{Team, TeamVisibility}, |
| 50 | + utilities::DateTimeBridge, |
| 51 | + }, |
| 52 | + }; |
| 53 | + |
| 54 | + |
| 55 | + #[derive(Default)] |
| 56 | + pub struct ResourcesQuery; |
| 57 | + |
| 58 | + #[derive(InputObject)] |
| 59 | + pub struct TaskFilter { |
| 60 | + // placeholder |
| 61 | + } |
| 62 | + |
| 63 | + #[derive(InputObject)] |
| 64 | + pub struct MemberFilter { |
| 65 | + // placeholder |
| 66 | + } |
| 67 | + |
| 68 | + #[derive(InputObject)] |
| 69 | + pub struct TeamFilter { |
| 70 | + // placeholder |
| 71 | + } |
| 72 | + |
| 73 | + #[derive(InputObject)] |
| 74 | + pub struct ProjectFilter { |
| 75 | + // placeholder |
| 76 | + } |
| 77 | + |
| 78 | + #[Object] |
| 79 | + impl ResourcesQuery { |
| 80 | + async fn tasks(&self, ctx: &Context<'_>, _filter: Option<TaskFilter>) -> Result<Vec<Task>> { |
| 81 | + // placeholder |
| 82 | + } |
| 83 | + |
| 84 | + async fn task_by_id(&self, ctx: &Context<'_>, id: Uuid) -> Result<Task> { |
| 85 | + // placeholder |
| 86 | + } |
| 87 | + |
| 88 | + async fn members( |
| 89 | + &self, |
| 90 | + ctx: &Context<'_>, |
| 91 | + _filter: Option<MemberFilter>, |
| 92 | + ) -> Result<Vec<Member>> { |
| 93 | + // placeholder |
| 94 | + } |
| 95 | + |
| 96 | + async fn member_by_id(&self, ctx: &Context<'_>, id: Uuid) -> Result<Member> { |
| 97 | + // placeholder |
| 98 | + } |
| 99 | + |
| 100 | + async fn member_by_email(&self, ctx: &Context<'_>, email: String) -> Result<Member> { |
| 101 | + // placeholder |
| 102 | + } |
| 103 | + |
| 104 | + async fn projects( |
| 105 | + &self, |
| 106 | + ctx: &Context<'_>, |
| 107 | + _filter: Option<ProjectFilter>, |
| 108 | + ) -> Result<Vec<Project>> { |
| 109 | + // placeholder |
| 110 | + } |
| 111 | + |
| 112 | + async fn project_by_id(&self, ctx: &Context<'_>, id: Uuid) -> Result<Project> { |
| 113 | + // placeholder |
| 114 | + } |
| 115 | + |
| 116 | + async fn teams(&self, ctx: &Context<'_>, _filter: Option<TeamFilter>) -> Result<Vec<Team>> { |
| 117 | + // placeholder |
| 118 | + } |
| 119 | + |
| 120 | + async fn team_by_id(&self, ctx: &Context<'_>, id: Uuid) -> Result<Team> { |
| 121 | + // placeholder |
| 122 | + } |
| 123 | + |
| 124 | + async fn labels(&self, ctx: &Context<'_>) -> Result<Vec<Label>> { |
| 125 | + // placeholder |
| 126 | + } |
| 127 | + |
| 128 | + async fn me(&self, ctx: &Context<'_>) -> Result<Member> { |
| 129 | + // placeholder |
| 130 | + } |
| 131 | + |
| 132 | + async fn activity( |
| 133 | + &self, |
| 134 | + ctx: &Context<'_>, |
| 135 | + resource_type: Option<ActivityResourceType>, |
| 136 | + resource_id: Option<Uuid>, |
| 137 | + operation_type: Option<ActivityOperationType>, |
| 138 | + member_id: Option<Uuid>, |
| 139 | + ) -> Result<Vec<Activity>> { |
| 140 | + // placeholder |
| 141 | + } |
| 142 | + } |
| 143 | + ``` |
| 144 | + |
| 145 | +- output: |
| 146 | + |
| 147 | + - ```yaml |
| 148 | + Resource: Library Imports |
| 149 | + - std, async_graphql, chrono, uuid, crate |
| 150 | + |
| 151 | + Resource: Input Filters |
| 152 | + - TaskFilter, MemberFilter, TeamFilter, ProjectFilter |
| 153 | + |
| 154 | + Resource: ResourcesQuery Object |
| 155 | + Operation: tasks |
| 156 | + - Query tasks from database |
| 157 | + Operation: task_by_id |
| 158 | + - Query a specific task by ID from database |
| 159 | + Operation: members |
| 160 | + - Query members from database |
| 161 | + Operation: member_by_id |
| 162 | + - Query a specific member by ID from database |
| 163 | + Operation: member_by_email |
| 164 | + - Query a specific member by email from database |
| 165 | + Operation: projects |
| 166 | + - Query projects from database |
| 167 | + Operation: project_by_id |
| 168 | + - Query a specific project by ID from database |
| 169 | + Operation: teams |
| 170 | + - Query teams from database |
| 171 | + Operation: team_by_id |
| 172 | + - Query a specific team by ID from database |
| 173 | + Operation: labels |
| 174 | + - Query labels from database |
| 175 | + Operation: me |
| 176 | + - Query the authenticated member's data from database |
| 177 | + Operation: activity |
| 178 | + - Query activity logs from database with optional filters |
| 179 | + ``` |
0 commit comments