Add filename field to Evidence type
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
@@ -76,6 +76,7 @@ const controlOverviewPageQuery = graphql`
|
||||
id
|
||||
fileUrl
|
||||
mimeType
|
||||
filename
|
||||
size
|
||||
state
|
||||
createdAt
|
||||
@@ -816,7 +817,7 @@ function ControlOverviewPageContent({
|
||||
{getFileIcon(evidence.mimeType)}
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">
|
||||
{evidence.name}
|
||||
{evidence.filename}
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 flex items-center gap-2">
|
||||
<span>{formatFileSize(evidence.size)}</span>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<2ce0834e0bd8b3d2937b34ebf91f9a69>>
|
||||
* @generated SignedSource<<005ee5181eeb4c0865e7e76dcb6b3aac>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -33,6 +33,7 @@ export type ControlOverviewPageQuery$data = {
|
||||
readonly node: {
|
||||
readonly createdAt: string;
|
||||
readonly fileUrl: string;
|
||||
readonly filename: string;
|
||||
readonly id: string;
|
||||
readonly mimeType: string;
|
||||
readonly size: number;
|
||||
@@ -186,6 +187,13 @@ v11 = [
|
||||
"name": "mimeType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "filename",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -413,7 +421,7 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "9738657b3d99bf6d85fd5333972e68f1",
|
||||
"cacheID": "0747630c87fd59b419e5264fcede33bf",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
@@ -436,11 +444,11 @@ return {
|
||||
},
|
||||
"name": "ControlOverviewPageQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ControlOverviewPageQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n name\n description\n state\n category\n tasks(first: 100) {\n edges {\n node {\n id\n name\n description\n state\n evidences(first: 50) {\n edges {\n node {\n id\n fileUrl\n mimeType\n size\n state\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
|
||||
"text": "query ControlOverviewPageQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n name\n description\n state\n category\n tasks(first: 100) {\n edges {\n node {\n id\n name\n description\n state\n evidences(first: 50) {\n edges {\n node {\n id\n fileUrl\n mimeType\n filename\n size\n state\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "5c2829a1e6bc18d96db9e608fbfc4d6f";
|
||||
(node as any).hash = "0fc29eb31e33b025168ac8972109f853";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -324,6 +324,7 @@ type Evidence implements Node {
|
||||
mimeType: String!
|
||||
size: Int!
|
||||
state: EvidenceState!
|
||||
filename: String!
|
||||
|
||||
stateTransisions(
|
||||
first: Int
|
||||
|
||||
@@ -141,6 +141,7 @@ type ComplexityRoot struct {
|
||||
Evidence struct {
|
||||
CreatedAt func(childComplexity int) int
|
||||
FileURL func(childComplexity int) int
|
||||
Filename func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
MimeType func(childComplexity int) int
|
||||
Size func(childComplexity int) int
|
||||
@@ -702,6 +703,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Evidence.FileURL(childComplexity), true
|
||||
|
||||
case "Evidence.filename":
|
||||
if e.complexity.Evidence.Filename == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Evidence.Filename(childComplexity), true
|
||||
|
||||
case "Evidence.id":
|
||||
if e.complexity.Evidence.ID == nil {
|
||||
break
|
||||
@@ -2184,6 +2192,7 @@ type Evidence implements Node {
|
||||
mimeType: String!
|
||||
size: Int!
|
||||
state: EvidenceState!
|
||||
filename: String!
|
||||
|
||||
stateTransisions(
|
||||
first: Int
|
||||
@@ -5319,6 +5328,44 @@ func (ec *executionContext) fieldContext_Evidence_state(_ context.Context, field
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Evidence_filename(ctx context.Context, field graphql.CollectedField, obj *types.Evidence) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Evidence_filename(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Filename, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Evidence_filename(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Evidence",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type String does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Evidence_stateTransisions(ctx context.Context, field graphql.CollectedField, obj *types.Evidence) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Evidence_stateTransisions(ctx, field)
|
||||
if err != nil {
|
||||
@@ -5617,6 +5664,8 @@ func (ec *executionContext) fieldContext_EvidenceEdge_node(_ context.Context, fi
|
||||
return ec.fieldContext_Evidence_size(ctx, field)
|
||||
case "state":
|
||||
return ec.fieldContext_Evidence_state(ctx, field)
|
||||
case "filename":
|
||||
return ec.fieldContext_Evidence_filename(ctx, field)
|
||||
case "stateTransisions":
|
||||
return ec.fieldContext_Evidence_stateTransisions(ctx, field)
|
||||
case "createdAt":
|
||||
@@ -14031,6 +14080,11 @@ func (ec *executionContext) _Evidence(ctx context.Context, sel ast.SelectionSet,
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "filename":
|
||||
out.Values[i] = ec._Evidence_filename(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "stateTransisions":
|
||||
field := field
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ func NewEvidence(e *coredata.Evidence) *Evidence {
|
||||
ID: e.ID,
|
||||
State: e.State,
|
||||
FileURL: "",
|
||||
Filename: e.Filename,
|
||||
MimeType: e.MimeType,
|
||||
Size: int(e.Size),
|
||||
CreatedAt: e.CreatedAt,
|
||||
|
||||
@@ -167,6 +167,7 @@ type Evidence struct {
|
||||
MimeType string `json:"mimeType"`
|
||||
Size int `json:"size"`
|
||||
State coredata.EvidenceState `json:"state"`
|
||||
Filename string `json:"filename"`
|
||||
StateTransisions *EvidenceStateTransitionConnection `json:"stateTransisions"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
||||
Reference in New Issue
Block a user