Skip to content

Commit

Permalink
setup a GP Joule app
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-goebel committed Feb 22, 2024
1 parent 4827a50 commit 5f7faeb
Show file tree
Hide file tree
Showing 42 changed files with 160 additions and 156 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN go mod download

RUN DATE=$(date) && \
GIT_COMMIT=$(git rev-list -1 HEAD) && \
go build -ldflags "-X 'template/apiservices.BuildTimestamp=$DATE' -X 'template/apiservices.GitCommit=$GIT_COMMIT'" -o ../app
go build -ldflags "-X 'gp-joule/apiservices.BuildTimestamp=$DATE' -X 'gp-joule/apiservices.GitCommit=$GIT_COMMIT'" -o ../app

FROM eliona/base-alpine:latest AS target

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Leicom ITEC AG
Copyright (c) 2024 Leicom ITEC AG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# App Template
# Eliona App for GP Joule

This template is a part of the Eliona App SDK. It can be used to create an app stub for an Eliona environment.
This app connects [GP Joule API](https://www.gp-joule.com/) and gathers information about data of charging stations.

## Configuration

Expand Down Expand Up @@ -34,11 +34,11 @@ This initialization can be handled by the `reset.sql` script.

<mark>Todo: Describe other tables if the app needs them.</mark>

The app requires configuration data that remains in the database. To do this, the app creates its own database schema `template` during initialization. To modify and handle the configuration data the app provides an API access. Have a look at the [API specification](https://eliona-smart-building-assistant.github.io/open-api-docs/?https://raw.githubusercontent.com/eliona-smart-building-assistant/app-template/develop/openapi.yaml) how the configuration tables should be used.
The app requires configuration data that remains in the database. To do this, the app creates its own database schema `gp_joule` during initialization. To modify and handle the configuration data the app provides an API access. Have a look at the [API specification](https://eliona-smart-building-assistant.github.io/open-api-docs/?https://raw.githubusercontent.com/eliona-smart-building-assistant/gp-joule-app/develop/openapi.yaml) how the configuration tables should be used.

- `template.configuration`: Contains configuration of the app. Editable through the API.
- `gp_joule.configuration`: Contains configuration of the app. Editable through the API.

- `template.asset`: Provides asset mapping. Maps broker's asset IDs to Eliona asset IDs.
- `gp_joule.asset`: Provides asset mapping. Maps broker's asset IDs to Eliona asset IDs.

**Generation**: to generate access method to database see Generation section below.

Expand All @@ -49,7 +49,7 @@ The app requires configuration data that remains in the database. To do this, th

The app provides its own API to access configuration data and other functions. The full description of the API is defined in the `openapi.yaml` OpenAPI definition file.

- [API Reference](https://eliona-smart-building-assistant.github.io/open-api-docs/?https://raw.githubusercontent.com/eliona-smart-building-assistant/app-template/develop/openapi.yaml) shows details of the API
- [API Reference](https://eliona-smart-building-assistant.github.io/open-api-docs/?https://raw.githubusercontent.com/eliona-smart-building-assistant/gp-joule-app/develop/openapi.yaml) shows details of the API

**Generation**: to generate api server stub see Generation section below.

Expand All @@ -67,7 +67,7 @@ The data is written for each device, structured into different subtypes of Elino

### Continuous asset creation ###

Assets for all devices connected to the Template account are created automatically when the configuration is added.
Assets for all devices connected to the GP Joule API are created automatically when a configuration is added.

To select which assets to create, a filter could be specified in config. The schema of the filter is defined in the `openapi.yaml` file.

Expand Down
4 changes: 2 additions & 2 deletions apiserver/api.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/api_configuration.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/api_customization.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/api_version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/error.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/helpers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/impl.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/logger.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/model_configuration.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/model_dashboard.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/model_filter_rule.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/model_widget.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/model_widget_data.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/routers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* App template API
* GP Joule app API
*
* API to access and configure the app template
* API to access and configure the GP Joule app
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
Expand Down
4 changes: 2 additions & 2 deletions apiservices/api_configuration_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package apiservices
import (
"context"
"errors"
"gp-joule/apiserver"
"gp-joule/conf"
"net/http"
"template/apiserver"
"template/conf"
)

// ConfigurationAPIService is a service that implements the logic for the ConfigurationAPIServicer
Expand Down
4 changes: 2 additions & 2 deletions apiservices/api_customization_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package apiservices

import (
"context"
"gp-joule/apiserver"
"net/http"
"template/apiserver"
)

// CustomizationAPIService is a service that implements the logic for the CustomizationAPIServicer
Expand All @@ -34,7 +34,7 @@ func NewCustomizationAPIService() apiserver.CustomizationAPIServicer {

// GetDashboardTemplateByName - Get a full dashboard template
func (s *CustomizationAPIService) GetDashboardTemplateByName(ctx context.Context, dashboardTemplateName string, projectId string) (apiserver.ImplResponse, error) {
if dashboardTemplateName == "Template" {
if dashboardTemplateName == "GP Joule" {
return apiserver.ImplResponse{Code: http.StatusNotImplemented}, nil
} else {
return apiserver.ImplResponse{Code: http.StatusNotFound}, nil
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_version_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package apiservices
import (
"context"
"encoding/json"
"gp-joule/apiserver"
"io"
"net/http"
"os"
"template/apiserver"

"github.com/eliona-smart-building-assistant/go-utils/common"
"github.com/eliona-smart-building-assistant/go-utils/log"
Expand Down
10 changes: 5 additions & 5 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ package main

import (
"context"
"gp-joule/apiserver"
"gp-joule/apiservices"
"gp-joule/appdb"
"gp-joule/conf"
"gp-joule/eliona"
"net/http"
"sync"
"template/apiserver"
"template/apiservices"
"template/appdb"
"template/conf"
"template/eliona"
"time"

"github.com/eliona-smart-building-assistant/go-eliona/app"
Expand Down
Loading

0 comments on commit 5f7faeb

Please sign in to comment.