Compare commits

...

6 Commits

Author SHA1 Message Date
KD
c6d17b4904 Merge branch 'token_model' into 'main'
Added token model

See merge request kdeng00/icarus-models!13
2025-03-09 21:43:23 +00:00
KD
f52f9d65fd Added token model 2025-03-09 21:43:22 +00:00
KD
f8662b6020 Merge branch 'ci_variable_checkl' into 'main'
Removing rule for now

See merge request kdeng00/icarus-models!12
2025-03-09 21:26:01 +00:00
KD
e7517f94dc Removing rule for now 2025-03-09 21:26:01 +00:00
KD
98e187056d Merge branch 'enchance_ci' into 'main'
Enhancing ci file

See merge request kdeng00/icarus-models!11
2025-03-09 19:45:42 +00:00
2bd6fd8f85 Enhancing ci file 2025-03-09 15:42:55 -04:00
4 changed files with 56 additions and 3 deletions

View File

@@ -8,9 +8,10 @@ build:
image: rust:1.85 image: rust:1.85
script: script:
- cargo build --release - cargo build --release
- ls -R target/release/
artifacts: artifacts:
paths: paths:
- target/release/icarus-models - target/release/
expire_in: 1 week expire_in: 1 week
cache: cache:
key: "cargo-cache" key: "cargo-cache"
@@ -29,6 +30,16 @@ test:
- target/ - target/
- ~/.cargo/ - ~/.cargo/
test_variable:
stage: test
image: rust:1.85
script:
- echo "Checking CARGO_LOGIN_TOKEN..."
- if [[ -z "$CARGO_LOGIN_TOKEN" ]]; then echo "CARGO_LOGIN_TOKEN is empty!"; exit 1; else echo "CARGO_LOGIN_TOKEN is set."; fi
- env
rules:
- if: '$CI_COMMIT_TAG'
deploy: deploy:
stage: deploy stage: deploy
image: rust:1.85 image: rust:1.85
@@ -36,7 +47,8 @@ deploy:
- echo "Printing environment" - echo "Printing environment"
- env - env
- cargo login "$CARGO_LOGIN_TOKEN" - cargo login "$CARGO_LOGIN_TOKEN"
- cargo publish - echo "Next step"
# - cargo publish
dependencies: dependencies:
- build - build
rules: rules:

View File

@@ -2,7 +2,7 @@
name = "icarus-models" name = "icarus-models"
description = "models used for the icarus project" description = "models used for the icarus project"
license = "MIT" license = "MIT"
version = "0.1.0" version = "0.1.1"
edition = "2024" edition = "2024"
[dependencies] [dependencies]

View File

@@ -1,5 +1,6 @@
pub mod access_level; pub mod access_level;
pub mod login_result; pub mod login_result;
pub mod token;
pub mod user; pub mod user;
pub fn add(left: u64, right: u64) -> u64 { pub fn add(left: u64, right: u64) -> u64 {

40
src/token.rs Normal file
View File

@@ -0,0 +1,40 @@
use std::default::Default;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Token {
pub scope: String,
pub expiration: i32,
pub audience: String,
pub issuer: String,
pub issued: i32,
}
impl Default for Token {
fn default() -> Self {
Token {
scope: String::new(),
expiration: -1,
audience: String::new(),
issuer: String::new(),
issued: -1,
}
}
}
impl Token {
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
return serde_json::to_string_pretty(&self);
}
// TODO: Implement
pub fn token_expired(&self) -> bool {
return false;
}
// TODO: Implement
pub fn contains_scope(&self, des_scope: String) -> bool {
return false;
}
}