-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add VirusTotal Results to API (#92)
* feat: add virustotal results to api * fix: add missing files from commit, fix migration * fix: remove unused vars * cleanup commented out code * fix comments, naming of functions, bulk saving * add newline back to gqlgrn * fix lint errors * fix generated.go being out of sync * fix migration sum * switch to virustotal_results output * update migration to remove url * reorganized code around virus total * resolved conflicts from staging * redo migrations/schema, fix formatting issues * fix migration hash * use devbox to generate files
- Loading branch information
1 parent
e0e42f8
commit fea5bc3
Showing
38 changed files
with
5,334 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package schema | ||
|
||
import ( | ||
"entgo.io/ent" | ||
"entgo.io/ent/schema/edge" | ||
"entgo.io/ent/schema/field" | ||
"entgo.io/ent/schema/index" | ||
) | ||
|
||
type VirustotalResult struct { | ||
ent.Schema | ||
} | ||
|
||
func (VirustotalResult) Mixin() []ent.Mixin { | ||
return []ent.Mixin{ | ||
IDMixin{}, | ||
TimeMixin{}, | ||
} | ||
} | ||
|
||
func (VirustotalResult) Fields() []ent.Field { | ||
return []ent.Field{ | ||
field.Bool("safe").Default(false), | ||
field.String("hash").MaxLen(64).NotEmpty(), | ||
field.String("file_name").NotEmpty(), | ||
field.String("version_id").MaxLen(14).NotEmpty(), | ||
} | ||
} | ||
|
||
func (VirustotalResult) Indexes() []ent.Index { | ||
return []ent.Index{ | ||
index.Fields("safe"), | ||
index.Fields("hash", "version_id").Unique(), | ||
index.Fields("file_name"), | ||
} | ||
} | ||
|
||
func (VirustotalResult) Edges() []ent.Edge { | ||
return []ent.Edge{ | ||
edge.From("version", Version.Type). | ||
Ref("virustotal_results"). | ||
Field("version_id"). | ||
Unique(). | ||
Required(), | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.