30 Commits

Author SHA1 Message Date
13d7fce0be Revert "var for images"
All checks were successful
checks / lint (pull_request) Successful in 4s
checks / build (pull_request) Successful in 2m11s
checks / test (pull_request) Successful in 2m2s
This reverts commit 0c3ecb2730.
2023-10-21 14:14:27 -07:00
0c3ecb2730 var for images 2023-10-21 14:14:01 -07:00
3cad519f00 more concise
All checks were successful
checks / lint (pull_request) Successful in 4s
checks / build (pull_request) Successful in 2m13s
checks / test (pull_request) Successful in 2m0s
2023-10-21 14:12:12 -07:00
f9417f49de Revert "more concise"
This reverts commit a0e6005acd.
2023-10-21 14:11:49 -07:00
a0e6005acd more concise 2023-10-21 14:10:44 -07:00
06708f6038 re-merge file
All checks were successful
checks / lint (pull_request) Successful in 5s
checks / build (pull_request) Successful in 2m16s
checks / test (pull_request) Successful in 2m1s
2023-10-21 13:54:28 -07:00
79d263cbb7 only run on some path changes
All checks were successful
lint / lint (pull_request) Successful in 4s
checks / build (pull_request) Successful in 2m10s
checks / test (pull_request) Successful in 1m58s
2023-10-21 13:50:21 -07:00
cf0d51fca5 remove runner tag
All checks were successful
checks / lint (pull_request) Successful in 5s
checks / build (pull_request) Successful in 2m12s
checks / test (pull_request) Successful in 2m2s
2023-10-21 13:41:29 -07:00
7682dc022c try removing runner tag
All checks were successful
checks / lint (pull_request) Successful in 4s
checks / build (pull_request) Successful in 2m9s
checks / test (pull_request) Successful in 2m0s
2023-10-21 13:40:00 -07:00
763ebea60a change triggers
All checks were successful
checks / lint (pull_request) Successful in 5s
checks / build (pull_request) Successful in 2m6s
checks / test (pull_request) Successful in 1m56s
2023-10-21 13:20:41 -07:00
3fa9d65966 change triggers
All checks were successful
checks / lint (pull_request) Successful in 5s
checks / build (pull_request) Successful in 2m6s
checks / test (pull_request) Successful in 2m3s
2023-10-21 13:17:12 -07:00
39391d17a4 reorder triggers 2023-10-21 13:15:54 -07:00
563f6dd3e4 only run for push on main, or for pr 2023-10-21 13:06:42 -07:00
c7b13c2572 image changes
All checks were successful
checks / lint (push) Successful in 5s
checks / build (push) Successful in 2m11s
checks / test (push) Successful in 2m3s
2023-10-21 12:58:19 -07:00
c287334af2 add build deps to ci docker image
Some checks reported warnings
checks / lint (push) Successful in 4s
checks / test (push) Has been cancelled
checks / build (push) Has been cancelled
2023-10-21 12:57:31 -07:00
d6dfe7e525 image changes
Some checks failed
checks / lint (push) Successful in 5s
checks / build (push) Successful in 2m12s
checks / test (push) Failing after 29s
2023-10-21 12:54:44 -07:00
668e5dbacd names and images changes
Some checks failed
checks / lint (push) Successful in 4s
checks / build (push) Failing after 27s
checks / test (push) Failing after 27s
2023-10-21 12:51:49 -07:00
3ef2eff8c3 automated build and test
Some checks failed
checks / format (push) Failing after 27s
2023-10-21 12:40:59 -07:00
e56a40a469 move some steps into the base image
All checks were successful
checks / format (push) Successful in 5s
2023-10-21 12:33:45 -07:00
f55d57c8ef fix fmt
All checks were successful
checks / format (push) Successful in 6s
2023-10-21 02:21:52 -07:00
a32e7757c5 test
Some checks failed
checks / format (push) Failing after 6s
2023-10-21 02:20:04 -07:00
2659b641ba test
Some checks failed
checks / format (push) Failing after 39s
2023-10-21 02:18:59 -07:00
8fb226fafd add node
Some checks failed
checks / format (push) Failing after 43s
checks / format (pull_request) Failing after 43s
2023-10-21 01:51:53 -07:00
9c97e00d5a add checkout
Some checks failed
checks / format (push) Failing after 8s
checks / format (pull_request) Failing after 3s
2023-10-21 01:45:53 -07:00
7e49f33b95 add debug ls
Some checks failed
checks / format (push) Failing after 2s
checks / format (pull_request) Failing after 3s
2023-10-21 01:42:24 -07:00
35bb9081ab add debug ls
Some checks failed
checks / format (push) Failing after 3s
checks / format (pull_request) Failing after 2s
2023-10-21 01:41:08 -07:00
b98fd1352a add rustfmt
Some checks failed
checks / format (push) Failing after 2s
checks / format (pull_request) Failing after 2s
2023-10-21 01:39:23 -07:00
a27214c8da Revert "test"
This reverts commit 81158ca818.
2023-10-21 01:39:23 -07:00
b53c875eac test 2023-10-21 01:39:23 -07:00
0e92eda123 add automated format check 2023-10-21 01:39:23 -07:00
5 changed files with 74 additions and 266 deletions

View File

@ -0,0 +1,44 @@
name: checks
on:
pull_request:
paths: &CODE_PATHS
- 'src/**'
- 'Cargo*'
push:
paths: *CODE_PATHS
branches:
- main
jobs:
# TODO(cascode) cache checkout for build and test stages?
lint:
container:
# TODO use communitymedia docker registry
image: "cascode/aural-isle-ci:0"
steps:
- uses: actions/checkout@v3
with:
github-server-url: "https://code.communitymedia.network"
- name: rustfmt
run: cargo fmt --check
build:
container:
# TODO use communitymedia docker registry
image: "cascode/aural-isle-ci:2"
steps:
- uses: actions/checkout@v3
with:
github-server-url: "https://code.communitymedia.network"
- name: build
run: cargo build
# TODO(cascode) cache builds for test stage
test:
container:
# TODO use communitymedia docker registry
image: "cascode/aural-isle-ci:2"
steps:
- uses: actions/checkout@v3
with:
github-server-url: "https://code.communitymedia.network"
- name: run unit tests
run: cargo test

View File

@ -372,14 +372,9 @@ struct Video {
# Collection
A Collection represents one or more Albums, Tracks, and/or OtherProducts that are offered together as a package for Purchase
A Collection represents one or more Albums and/or Tracks that are offered together as a package for Purchase
``` rust
enum CollectionItem {
Album(AlbumId),
Track(TrackId),
OtherProduct(OtherProductId),
}
struct CollectionId {
id: String,
}
@ -395,7 +390,9 @@ struct Collection {
is_available: bool,
deleted_by: Option<PersonId>,
deleted_at: Option<chrono::DateTime>,
collection_items: Option<Vec<CollectionMember>>,
albums: Option<Vec<Album>>,
tracks: Option<Vec<Track>>,
other_products: Option<Vec<OtherProduct>>,
}
```
@ -425,7 +422,7 @@ struct OtherProduct {
# Purchase
A Purchase represents one or more Tracks, Albums, Collections, and/or OtherProducts that a Person purchases from an Artist or Label through the server.
A Purchase represents one or more Tracks or Albums that a Person purchases from an Artist or Label through the server.
``` rust
enum PurchaseItemType {
@ -445,12 +442,11 @@ struct Sku {
item: PurchaseItemType,
variant: Option<String>,
description: Option<String>,
price: rusty_money::Money,
price: Option<rusty_money::Money>,
requires_shipping: bool,
shipping_charge: Option<rusty_money::Money>,
}
struct LineItem {
id: LineItemId,
struct PurchaseItem {
id: PurchaseItemId,
sku: SkuId,
quantity: usize,
}
@ -465,14 +461,12 @@ enum PurchaseState {
}
struct Purchase {
id: String,
items: Vec<LineItem>,
items: Vec<PurchaseItem>,
state: PurchaseState,
purchased_by: Option<Person>,
purchased_by: Person,
purchased_at: Option<chrono::DateTime>,
fulfilled_by: Option<Person>,
fulfilled_at: Option<chrono::DateTime>,
coupons_applied: Option<Vec<CouponCodeId>>,
total_charge: rusty_money::Money,
}
```

260
SCHEMA.md
View File

@ -705,262 +705,26 @@ CREATE INDEX ArticleComments_article_id_IDX ON ArticleComments (article_id);
CREATE INDEX ArticleComments_comment_id_IDX ON ArticleComments (comment_id);
```
# OtherProducts
The OtherProducts table will contain products for sale that are not Albums nor Tracks nor Collections.
# LabelImages
``` sql
CREATE TABLE OtherProducts (
id TEXT(36),
name TEXT,
description TEXT,
created_by TEXT(36),
created_at INTEGER,
modified_by TEXT(36),
modified_at INTEGER,
deleted_by TEXT(36),
deleted_at INTEGER,
is_public INTEGER DEFAULT (0),
is_available INTEGER DEFAULT (0),
requires_shipping INTEGER DEFAULT (0),
CONSTRAINT OtherProducts_PK PRIMARY KEY (id),
CONSTRAINT OtherProducts_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
CONSTRAINT OtherProducts_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
CONSTRAINT OtherProducts_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
);
CREATE INDEX OtherProducts_name_IDX ON OtherProducts (name);
CREATE INDEX OtherProducts_description_IDX ON OtherProducts (description);
CREATE INDEX OtherProducts_created_by_IDX ON OtherProducts (created_by);
CREATE INDEX OtherProducts_created_at_IDX ON OtherProducts (created_at);
CREATE INDEX OtherProducts_modified_by_IDX ON OtherProducts (modified_by);
CREATE INDEX OtherProducts_modified_at_IDX ON OtherProducts (modified_at);
CREATE INDEX OtherProducts_deleted_by_IDX ON OtherProducts (deleted_by);
CREATE INDEX OtherProducts_deleted_at_IDX ON OtherProducts (deleted_at);
CREATE INDEX OtherProducts_is_public_IDX ON OtherProducts (is_public);
CREATE INDEX OtherProducts_is_available_IDX ON OtherProducts (is_available);
CREATE INDEX OtherProducts_requires_shipping_IDX ON OtherProducts (requires_shipping);
```
# LabelVideos
# Collections
The Collections table will contain Collections where each Collection is comprised of one or more Tracks, Albums, and/or OtherProducts packaged together for sale.
# ArtistImages
``` sql
CREATE TABLE Collections (
id TEXT(36),
name TEXT,
description TEXT,
created_by TEXT(36),
created_at INTEGER,
modified_by TEXT(36),
modified_at INTEGER,
deleted_by TEXT(36),
deleted_at INTEGER,
is_public INTEGER DEFAULT (0),
is_available INTEGER DEFAULT (0),
CONSTRAINT Collections_PK PRIMARY KEY (id),
CONSTRAINT Collections_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
CONSTRAINT Collections_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
CONSTRAINT Collections_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
);
CREATE INDEX Collections_name_IDX ON Collections (name);
CREATE INDEX Collections_description_IDX ON Collections (description);
CREATE INDEX Collections_created_by_IDX ON Collections (created_by);
CREATE INDEX Collections_created_at_IDX ON Collections (created_at);
CREATE INDEX Collections_modified_by_IDX ON Collections (modified_by);
CREATE INDEX Collections_modified_at_IDX ON Collections (modified_at);
CREATE INDEX Collections_deleted_by_IDX ON Collections (deleted_by);
CREATE INDEX Collections_deleted_at_IDX ON Collections (deleted_at);
CREATE INDEX Collections_is_public_IDX ON Collections (is_public);
CREATE INDEX Collections_is_available_IDX ON Collections (is_available);
```
# ArtistVideos
# CollectionAlbums
The CollectionAlbums table will relate a Collection to the Album(s) it contains.
# AlbumImages
``` sql
CREATE TABLE CollectionAlbums (
collection_id TEXT(36),
album_id TEXT(36),
CONSTRAINT CollectionAlbums_PK PRIMARY KEY (collection_id,album_id),
CONSTRAINT CollectionAlbums_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
CONSTRAINT CollectionAlbums_FK_1 FOREIGN KEY (album_id) REFERENCES Albums(id) ON DELETE CASCADE
);
CREATE INDEX CollectionAlbums_collection_id_IDX ON CollectionAlbums (collection_id);
CREATE INDEX CollectionAlbums_album_id_IDX ON CollectionAlbums (album_id);
```
# AlbumVideos
# CollectionTracks
The CollectionTracks table will relate a Collection to the Track(s) it contains.
# TrackImages
``` sql
CREATE TABLE CollectionTracks (
collection_id TEXT(36),
track_id TEXT(36),
CONSTRAINT CollectionTracks_PK PRIMARY KEY (collection_id,track_id),
CONSTRAINT CollectionTracks_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
CONSTRAINT CollectionTracks_FK_1 FOREIGN KEY (track_id) REFERENCES Tracks(id) ON DELETE CASCADE
);
CREATE INDEX CollectionTracks_collection_id_IDX ON CollectionTracks (collection_id);
CREATE INDEX CollectionTracks_track_id_IDX ON CollectionTracks (track_id);
```
# TrackVideos
# CollectionOtherProducts
The CollectionOtherProducts table will relate a Collection to the OtherProduct(s) it contains.
# PlaylistImages
``` sql
CREATE TABLE CollectionOtherProducts (
collection_id TEXT(36),
other_product_id TEXT(36),
CONSTRAINT CollectionOtherProducts_PK PRIMARY KEY (collection_id,other_product_id),
CONSTRAINT CollectionOtherProducts_FK FOREIGN KEY (collection_id) REFERENCES Collections(id) ON DELETE CASCADE,
CONSTRAINT CollectionOtherProducts_FK_1 FOREIGN KEY (other_product_id) REFERENCES OtherProducts(id) ON DELETE CASCADE
);
CREATE INDEX CollectionOtherProducts_collection_id_IDX ON CollectionOtherProducts (collection_id);
CREATE INDEX CollectionOtherProducts_other_product_id_IDX ON CollectionOtherProducts (other_product_id);
```
# PlaylistVideos
# Skus
The Skus table will contain SKUs () representing items available for Purchase through the server.
# ArticleImages
``` sql
CREATE TABLE Skus (
id TEXT(36),
item_type TEXT,
item_id TEXT(36),
variant TEXT,
description TEXT,
price NUMERIC DEFAULT (0.00),
requires_shipping INTEGER DEFAULT (0),
shipping_charge NUMERIC DEFAULT (0.00),
CONSTRAINT Skus_PK PRIMARY KEY (id)
);
CREATE INDEX Skus_item_type_IDX ON Skus (item_type);
CREATE INDEX Skus_item_id_IDX ON Skus (item_id);
CREATE INDEX Skus_variant_IDX ON Skus (variant);
CREATE INDEX Skus_description_IDX ON Skus (description);
CREATE INDEX Skus_price_IDX ON Skus (price);
CREATE INDEX Skus_requires_shipping_IDX ON Skus (requires_shipping);
CREATE INDEX Skus_shipping_charge_IDX ON Skus (shipping_charge);
```
# LineItems
The LineItems table will contain individual SKUs and their associated quantites as part of a Purchase.
``` sql
CREATE TABLE LineItems (
id TEXT(36),
sku_id TEXT(36),
quantity INTEGER DEFAULT (1),
CONSTRAINT LineItems_PK PRIMARY KEY (id),
CONSTRAINT LineItems_FK FOREIGN KEY (sku_id) REFERENCES Skus(id)
);
CREATE INDEX LineItems_sku_id_IDX ON LineItems (sku_id);
CREATE INDEX LineItems_quantity_IDX ON LineItems (quantity);
```
# CouponCodes
The CouponCodes table will contain coupon codes that can be redeemed for a discount, either by amount or percentage, on a Purchase.
``` sql
CREATE TABLE CouponCodes (
id TEXT(36),
name TEXT,
code TEXT,
uses INTEGER DEFAULT (0),
max_uses INTEGER DEFAULT (0),
expiration INTEGER,
discount_flat NUMERIC DEFAULT (0.00),
discount_percentage NUMERIC DEFAULT (0.00),
is_sku_specific INTEGER DEFAULT (0),
is_active INTEGER DEFAULT (0),
created_by TEXT(36),
created_at INTEGER,
modified_by TEXT(36),
modified_at INTEGER,
deleted_by TEXT(36),
deleted_at INTEGER,
CONSTRAINT CouponCodes_PK PRIMARY KEY (id),
CONSTRAINT CouponCodes_FK FOREIGN KEY (created_by) REFERENCES Persons(id),
CONSTRAINT CouponCodes_FK_1 FOREIGN KEY (modified_by) REFERENCES Persons(id),
CONSTRAINT CouponCodes_FK_2 FOREIGN KEY (deleted_by) REFERENCES Persons(id)
);
CREATE INDEX CouponCodes_name_IDX ON CouponCodes (name);
CREATE UNIQUE INDEX CouponCodes_code_IDX ON CouponCodes (code);
CREATE INDEX CouponCodes_uses_IDX ON CouponCodes (uses);
CREATE INDEX CouponCodes_max_uses_IDX ON CouponCodes (max_uses);
CREATE INDEX CouponCodes_expiration_IDX ON CouponCodes (expiration);
CREATE INDEX CouponCodes_is_sku_specific_IDX ON CouponCodes (is_sku_specific);
CREATE INDEX CouponCodes_is_active_IDX ON CouponCodes (is_active);
CREATE INDEX CouponCodes_created_by_IDX ON CouponCodes (created_by);
CREATE INDEX CouponCodes_created_at_IDX ON CouponCodes (created_at);
CREATE INDEX CouponCodes_modified_by_IDX ON CouponCodes (modified_by);
CREATE INDEX CouponCodes_modified_at_IDX ON CouponCodes (modified_at);
CREATE INDEX CouponCodes_deleted_by_IDX ON CouponCodes (deleted_by);
CREATE INDEX CouponCodes_deleted_at_IDX ON CouponCodes (deleted_at);
```
# CouponCodeSkus
The CouponCodeSkus table will relate a CouponCode to one or more Skus the CouponCode can be applied to, if CouponCode.is_sku_specific is true. (If CouponCode.is_sku_specific is false the CouponCode can be applied to an entire Purchase regardless of the Skus being purchased.)
``` sql
CREATE TABLE CouponCodeSkus (
coupon_code_id TEXT(36),
sku_id TEXT(36),
CONSTRAINT CouponCodeSkus_PK PRIMARY KEY (coupon_code_id,sku_id),
CONSTRAINT CouponCodeSkus_FK FOREIGN KEY (coupon_code_id) REFERENCES CouponCodes(id),
CONSTRAINT CouponCodeSkus_FK_1 FOREIGN KEY (sku_id) REFERENCES Skus(id)
);
```
# Purchases
The Purchases table will contain Purchases!
``` sql
CREATE TABLE Purchases (
id TEXT(36),
state TEXT,
purchased_by TEXT(36),
purchased_at INTEGER,
fulfilled_by TEXT(36),
fulfilled_at INTEGER,
total_charge NUMERIC DEFAULT (0.00),
CONSTRAINT Purchases_PK PRIMARY KEY (id),
CONSTRAINT Purchases_FK FOREIGN KEY (purchased_by) REFERENCES Persons(id),
CONSTRAINT Purchases_FK_1 FOREIGN KEY (fulfilled_by) REFERENCES Persons(id)
);
CREATE INDEX Purchases_state_IDX ON Purchases (state);
CREATE INDEX Purchases_purchased_by_IDX ON Purchases (purchased_by);
CREATE INDEX Purchases_purchased_at_IDX ON Purchases (purchased_at);
CREATE INDEX Purchases_fulfilled_by_IDX ON Purchases (fulfilled_by);
CREATE INDEX Purchases_fulfilled_at_IDX ON Purchases (fulfilled_at);
CREATE INDEX Purchases_total_charge_IDX ON Purchases (total_charge);
```
# PurchaseLineItems
The PurchaseLineItems table will relate a Purchase to one or more LineItems.
``` sql
CREATE TABLE PurchaseLineItems (
purchase_id TEXT(36),
line_item_id TEXT(36),
CONSTRAINT PurchaseLineItems_PK PRIMARY KEY (purchase_id,line_item_id),
CONSTRAINT PurchaseLineItems_FK FOREIGN KEY (purchase_id) REFERENCES Purchases(id),
CONSTRAINT PurchaseLineItems_FK_1 FOREIGN KEY (line_item_id) REFERENCES LineItems(id) ON DELETE CASCADE
);
CREATE INDEX PurchaseLineItems_purchase_id_IDX ON PurchaseLineItems (purchase_id);
CREATE INDEX PurchaseLineItems_line_item_id_IDX ON PurchaseLineItems (line_item_id);
```
# PurchaseCouponCodes
The PurchaseCouponCodes table will relate a Purchase to one or more CouponCodes that were successfully applied to the Purchase.
``` sql
CREATE TABLE PurchaseCouponCodes (
purchase_id TEXT(36),
coupon_code_id TEXT(36),
CONSTRAINT PurchaseCouponCodes_PK PRIMARY KEY (purchase_id,coupon_code_id),
CONSTRAINT PurchaseCouponCodes_FK FOREIGN KEY (purchase_id) REFERENCES Purchases(id),
CONSTRAINT PurchaseCouponCodes_FK_1 FOREIGN KEY (coupon_code_id) REFERENCES CouponCodes(id)
);
CREATE INDEX PurchaseCouponCodes_purchase_id_IDX ON PurchaseCouponCodes (purchase_id);
CREATE INDEX PurchaseCouponCodes_coupon_code_id_IDX ON PurchaseCouponCodes (coupon_code_id);
```
# ArticleVideos

7
ci/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM rust:1.73-alpine3.18
#install build tooling
RUN apk add musl-dev && rustup component add rustfmt
# install gitea act_runner dependencies
RUN apk add nodejs git

View File

@ -2,8 +2,7 @@ use warp::Filter;
#[tokio::main]
async fn main() {
let hello = warp::get()
.map(|| format!("Hello world!"));
let hello = warp::get().map(|| format!("Hello world!"));
warp::serve(hello).run(([127, 0, 0, 1], 5309)).await;
}