Skip to content

Commit

Permalink
Merge pull request #2936 from SeedCompany/edgedb/file
Browse files Browse the repository at this point in the history
[EdgeDB] First WIP pass at file schema to get something for other places
  • Loading branch information
CarsonF authored Nov 10, 2023
2 parents 00dbf3e + b9eeb55 commit 1128312
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dbschema/engagement.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module default {
default := false;
};
paratextRegistryId: str;
# pnp: File;
pnp: File;

sentPrintingDate: cal::local_date {
annotation deprecated := "Legacy data";
Expand Down Expand Up @@ -122,8 +122,8 @@ module default {
mentor: User;
# position: Engagement::InternPosition;
# multi methodologies: ProductMethodology;
# countryOfOrigin: Location;
# growthPlan: File;
countryOfOrigin: Location;
growthPlan: File;

trigger connectCertificationCeremony after insert for each do (
insert Engagement::CertificationCeremony {
Expand Down
45 changes: 45 additions & 0 deletions dbschema/file.esdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module default {
type Directory extending File::Node {
# TODO how to update
required totalFiles: int32 {
default := 0;
};
}

# TODO how to front latest version info?
type File extending File::Node {
required mimeType: str;
}
}

module File {
type Version extending Node {
required mimeType: str;
}

abstract type Node extending default::Resource, Mixin::Named {
# TODO how to default to parent?
# optional to have tri-state. idk if needed but that's what I implemented in neo4j
public: bool;

required createdBy: default::User {
default := <default::User>(global default::currentUserId);
};
required modifiedBy: default::User {
default := <default::User>(global default::currentUserId);
rewrite update using (<default::User>(global default::currentUserId));
# TODO trigger change up the tree
# TODO trigger re-eval on node delete?
};

# TODO trigger directories evaluate
required size: int64;

link parent: Node;
multi link parents: Node {
# a way to determine order?
depth: int16; # todo enforce
}
# multi link children: Node;
}
}
10 changes: 5 additions & 5 deletions dbschema/location.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ module default {
constraint exclusive;
}
required type: Location::Type;

isoAlpha3: Location::IsoAlpha3Code {
constraint exclusive;
};

#TODO - links
#fundingAccount: FundingAccount;
#defaultFieldRegion: FieldRegion;
#mapImage: File;
mapImage: File;
}
}

module Location {
scalar type Type extending enum<
Country,
Expand All @@ -25,7 +25,7 @@ module Location {
State,
CrossBorderArea
>;

scalar type IsoAlpha3Code extending str {
constraint regexp(r'^[A-Z]{3}$');
}
Expand Down
2 changes: 1 addition & 1 deletion dbschema/project.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module default {
# link primaryLocation: Location;
# link marketingLocation: Location;
# link fieldRegion: FieldRegion;
# link rootDirectory: Directory;
link rootDirectory: Directory;

overloaded link projectContext: Project::Context {
default := (insert Project::Context);
Expand Down

0 comments on commit 1128312

Please sign in to comment.