11 changed files with 0 additions and 533 deletions
			
			
		- 
					9graph/resolvers/issue.resolvers.go
- 
					46graph/resolvers/issueitem.resolvers.go
- 
					12graph/resolvers/log.resolvers.go
- 
					191graph/resolvers/mutation.resolvers.go
- 
					101graph/resolvers/query.resolvers.go
- 
					2graph/schema/issue.gql
- 
					75graph/schema/issueitem.gql
- 
					60graph/schema/item.gql
- 
					14graph/schema/log.gql
- 
					11graph/schema/mutation.gql
- 
					12graph/schema/query.gql
| @ -1,46 +0,0 @@ | |||
| package resolvers | |||
| 
 | |||
| // This file will be automatically regenerated based on the schema, any resolver implementations
 | |||
| // will be copied through when generating and any unknown code will be moved to the end.
 | |||
| 
 | |||
| import ( | |||
| 	"context" | |||
| 
 | |||
| 	"git.aiterp.net/stufflog/server/graph/graphcore" | |||
| 	"git.aiterp.net/stufflog/server/graph/loaders" | |||
| 	"git.aiterp.net/stufflog/server/models" | |||
| ) | |||
| 
 | |||
| func (r *issueItemResolver) Issue(ctx context.Context, obj *models.IssueItem) (*models.Issue, error) { | |||
| 	return loaders.IssueLoaderFromContext(ctx).Load(obj.IssueID) | |||
| } | |||
| 
 | |||
| func (r *issueItemResolver) Item(ctx context.Context, obj *models.IssueItem) (*models.Item, error) { | |||
| 	return r.Database.Items().Find(ctx, obj.ItemID) | |||
| } | |||
| 
 | |||
| func (r *issueItemResolver) Remaining(ctx context.Context, obj *models.IssueItem) (int, error) { | |||
| 	if obj.Acquired { | |||
| 		return 0, nil | |||
| 	} | |||
| 
 | |||
| 	loader := loaders.LogsByIssueLoaderFromContext(ctx) | |||
| 	logs, err := loader.Load(obj.IssueID) | |||
| 	if err != nil { | |||
| 		return 0, err | |||
| 	} | |||
| 
 | |||
| 	remaining := obj.Quantity | |||
| 	for _, log := range logs { | |||
| 		if item := log.Item(obj.ID); item != nil { | |||
| 			remaining -= item.Amount | |||
| 		} | |||
| 	} | |||
| 
 | |||
| 	return remaining, nil | |||
| } | |||
| 
 | |||
| // IssueItem returns graphcore.IssueItemResolver implementation.
 | |||
| func (r *Resolver) IssueItem() graphcore.IssueItemResolver { return &issueItemResolver{r} } | |||
| 
 | |||
| type issueItemResolver struct{ *Resolver } | |||
| @ -1,75 +0,0 @@ | |||
| """ | |||
| An issue item is a requirement of an item under an issue. | |||
| """ | |||
| type IssueItem { | |||
|     "ID of the issue item listing." | |||
|     id: String! | |||
|     "The amount of the item associated with an issue." | |||
|     quantity: Int! | |||
|     "Whether the full quantity of item has been acquired." | |||
|     acquired: Boolean! | |||
| 
 | |||
|     "Parent issue of the issue item." | |||
|     issue: Issue! | |||
|     "The item associated with the issue." | |||
|     item: Item! | |||
|     "The amount of items remaining." | |||
|     remaining: Int! | |||
| } | |||
| 
 | |||
| "Input for the items query." | |||
| input IssueItemFilter { | |||
|     "Filter to only these IDs, used primarily by IDs." | |||
|     issueItemIds: [String!] | |||
|     "Filter to only these issues." | |||
|     issueIds: [String!] | |||
|     "Filter to only issues where these are the asignees." | |||
|     issueAssignees: [String!] | |||
|     "Filter to only issues where these are the owners." | |||
|     issueOwners: [String!] | |||
|     "Filter by issue minimum stage (inclusive)." | |||
|     issueMinStage: Int | |||
|     "Filter by issue maximum stage (inclusive)." | |||
|     issueMaxStage: Int | |||
|     "Filter to only list issue items with these items." | |||
|     itemIds: [String!] | |||
|     "Filter to only list issue items where the item has these tags." | |||
|     itemTags: [String!] | |||
|     "Only listed acquired or non-acquired items." | |||
|     acquired: Boolean | |||
| } | |||
| 
 | |||
| "Input for the items query." | |||
| input IssueIssueItemFilter { | |||
|     "Filter to only these IDs, used primarily by IDs." | |||
|     issueItemIds: [String!] | |||
|     "Filter to only list issue items with these items." | |||
|     itemIds: [String!] | |||
|     "Filter to only list issue items where the item has these tags." | |||
|     itemTags: [String!] | |||
|     "Only listed acquired or non-acquired items." | |||
|     acquired: Boolean | |||
| } | |||
| 
 | |||
| "Input for the createIssueItem mutation." | |||
| input IssueItemCreateInput { | |||
|     "Parent issue." | |||
|     issueId: String! | |||
|     "Item to associate with." | |||
|     itemId: String! | |||
|     "Quantity of the item." | |||
|     quanitty: Int! | |||
|     "Whether the item has already been acquired." | |||
|     acquired: Boolean | |||
| } | |||
| 
 | |||
| "Input for the editIssueItem mutation." | |||
| input IssueItemEditInput { | |||
|     "The ID of the issue item to edit." | |||
|     issueItemId: String! | |||
|     "Update the quantity of the item." | |||
|     setQuanitty: Int | |||
|     "Update whether the item has been acquired." | |||
|     setAcquired: Boolean | |||
| } | |||
| 
 | |||
| @ -1,60 +0,0 @@ | |||
| """ | |||
| An item that can be required for an issue. | |||
| """ | |||
| type Item { | |||
|     "The item's unique ID." | |||
|     id: String! | |||
|     "Name of the item." | |||
|     name: String! | |||
|     "A description of the item." | |||
|     description: String! | |||
|     "Item tags." | |||
|     tags: [String!]! | |||
|     "Quantity unit. Usually absent, but otherwise most often 'g' or 'ml'" | |||
|     quantityUnit: String | |||
|     "URL for the image, if available." | |||
|     imageUrl: String | |||
| } | |||
| 
 | |||
| "Filter for the items query." | |||
| input ItemFilter { | |||
|     "Get these item IDs. Mostly used internally." | |||
|     itemIds: [String!] | |||
|     "Limit to items with any of the following tags." | |||
|     tags: [String!] | |||
| } | |||
| 
 | |||
| "Input for the createItem mutation." | |||
| input ItemCreateInput { | |||
|     "Put a name on it." | |||
|     name: String! | |||
|     "Describe it for me." | |||
|     description: String! | |||
|     "Add a tag or a few" | |||
|     tags: [String!]! | |||
|     "Optional: Quanity unit." | |||
|     quantityUnit: String | |||
|     "Optional: Upload an image." | |||
|     image: Upload | |||
| } | |||
| 
 | |||
| "Input for the editItem mutation." | |||
| input ItemEditInput { | |||
|     "The item to edit." | |||
|     itemId: String! | |||
| 
 | |||
|     "Update the name." | |||
|     setName: String | |||
|     "Update the description." | |||
|     setDescription: String | |||
|     "Add new tags. The tags are added after removeTag tags are removed." | |||
|     addTags: [String!] | |||
|     "Remove existing tags. If a tag exists both here and in addTags, it will not be removed." | |||
|     removeTags: [String!] | |||
|     "Update quantity unit." | |||
|     setQuantityUnit: String | |||
|     "Clear quantity unit." | |||
|     clearQuantityUnit: Boolean | |||
|     "Update the image URL with a new image." | |||
|     updateImage: Upload | |||
| } | |||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue