Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asset dashboard added #385

Merged
merged 13 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/main_avinyawebapp-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: '3.16.8'
flutter-version: "3.13.1"
- run: flutter doctor -v

- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: "16.x"
- run: npm install -g [email protected]

# Get dependencies and build Flutter web app
Expand All @@ -37,7 +37,7 @@ jobs:
flutter clean
flutter pub outdated
flutter pub get

- name: Build Flutter app
run: |
cd campus/frontend
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Move Flutter build contents to node-app artifact
run: |
cp -R campus/frontend/build/web/* campus/deployment/node-app/public-flutter

- name: npm install, build, and test
run: |
cd campus/deployment/node-app
Expand All @@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
name: "Production"
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
Expand All @@ -80,11 +80,11 @@ jobs:
with:
name: node-app

- name: 'Deploy to Azure Web App'
- name: "Deploy to Azure Web App"
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'avinyawebapp-production'
slot-name: 'Production'
app-name: "avinyawebapp-production"
slot-name: "Production"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_87F56F6F4C724B4E91DFBC9BEF075487 }}
package: .
2 changes: 1 addition & 1 deletion campus/bffs/asset/api/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.5.0"
[[package]]
org = "avinyafoundation"
name = "asset_bff"
version = "0.1.0"
version = "1.1.0"
dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
Expand Down
11 changes: 9 additions & 2 deletions campus/bffs/asset/api/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ballerina/graphql;
public isolated client class GraphqlClient {
final graphql:Client graphqlClient;
public isolated function init(string serviceUrl, ConnectionConfig config = {}) returns graphql:ClientError? {
graphql:ClientConfiguration graphqlClientConfig = {timeout: config.timeout, forwarded: config.forwarded, poolConfig: config.poolConfig, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, validation: config.validation};
graphql:ClientConfiguration graphqlClientConfig = {auth: config.oauth2ClientCredentialsGrantConfig,timeout: config.timeout, forwarded: config.forwarded, poolConfig: config.poolConfig, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, validation: config.validation};
do {
if config.http1Settings is ClientHttp1Settings {
ClientHttp1Settings settings = check config.http1Settings.ensureType(ClientHttp1Settings);
Expand Down Expand Up @@ -233,7 +233,7 @@ public isolated client class GraphqlClient {
}

remote isolated function getInventoryDataByOrganization(string date, int organization_id) returns GetInventoryDataByOrganizationResponse|graphql:ClientError {
string query = string `query getInventoryDataByOrganization($organization_id:Int!,$date:String!) {inventory_data_by_organization(organization_id:$organization_id,date:$date) {id avinya_type_id consumable_id consumable {id name} quantity quantity_in quantity_out prev_quantity resource_property {id property value} created updated}}`;
string query = string `query getInventoryDataByOrganization($organization_id:Int!,$date:String!) {inventory_data_by_organization(organization_id:$organization_id,date:$date) {id avinya_type_id consumable_id consumable {id name} quantity quantity_in quantity_out prev_quantity is_below_threshold resource_property {id property value} created updated}}`;
map<anydata> variables = {"date": date, "organization_id": organization_id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetInventoryDataByOrganizationResponse>check performDataBinding(graphqlResponse, GetInventoryDataByOrganizationResponse);
Expand Down Expand Up @@ -372,4 +372,11 @@ public isolated client class GraphqlClient {
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetConsumableMonthlyReportResponse>check performDataBinding(graphqlResponse, GetConsumableMonthlyReportResponse);
}

remote isolated function getConsumableYearlyReport(int consumable_id, int year, int organization_id) returns GetConsumableYearlyReportResponse|graphql:ClientError {
string query = string `query getConsumableYearlyReport($organization_id:Int!,$consumable_id:Int!,$year:Int!) {consumable_yearly_report(organization_id:$organization_id,consumable_id:$consumable_id,year:$year) {consumable {id name} month_name quantity_in quantity_out resource_property {id property value}}}`;
map<anydata> variables = {"consumable_id": consumable_id, "year": year, "organization_id": organization_id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetConsumableYearlyReportResponse> check performDataBinding(graphqlResponse, GetConsumableYearlyReportResponse);
}
}
Loading
Loading