TUM-Dev / Campus-Backend

New backend written in go with gRPC as an API interface
GNU General Public License v3.0
15 stars 7 forks source link

v1 backend migration #7

Closed joschahenningsen closed 5 months ago

joschahenningsen commented 2 years ago

Cronjobs

Endpoints

This is a list of endpoints that should be served here (via rest and grpc): Update Note (previously unused in the Android app ⇒ needs a discussion)

Members/Users

notifications

Device

Feedback

Cafeterias

Kinos

News

other endpoints

Study Rooms (basically just a thin API-Wrapper around iris' api. Unclear if needed)

- [ ] `GET /studyroom/list`

Events And Tickets (currently unused ⇒ needs a discussion if this is needed)

- [ ] `GET /event/list` - [ ] `POST /event/ticket/my` - [ ] `POST /event/ticket/:ticket_id` - [ ] `GET /event/ticket//type/:event_id` - [ ] `POST /event/ticket/reserve/multiple` - [ ] `POST /event/ticket/payment/stripe/purchase/multiple` - [ ] `POST /event/ticket/payment/stripe/ephemeralkey` - [ ] `GET /event/ticket/status/:event_id`

Offloaded to [NavigaTUM](https://github.com/TUM-Dev/NavigaTUM)

## Opening Hours - [ ] `GET /openingtimes/:language` - [ ] `GET /locations/:location_id` - [ ] `GET /barrierfree/contacts` - [x] `GET /barrierfree/getBuilding2Gps` - [x] `GET /barrierfree/nerby/:building_id` - [x] `GET /barrierfree/listOfToilets` - [x] `GET /barrierfree/listOfElevators` - [ ] `GET /barrierfree/moreInformation`

kmodexc commented 2 years ago

Is openingtimes already migrated? I could not find it.

kordianbruck commented 2 years ago

Nope, that isn't being worked on yet.

barisconur commented 2 years ago

I am going to work on this task in the following weeks.

barisconur commented 2 years ago

Could you please give me some information about the migration? Is there a new api version and do we want to migrate these endpoints to the new one?

kmodexc commented 2 years ago

As i understand it, the old backend is private source so you cant take that as a starting point.

Some of these will be implemented in #1422

The code is located in the campus-backend repo and there is a swagger file so this is where you might start.

joschahenningsen commented 2 years ago

Yes, we basically want to reimplement the current (closed source) api written in php. It might make sense to open source it to aid the progress here. Let's discuss this in the next team meeting (ping @kordianbruck)

For further discussion I suggest meeting up about this on discord? @barisconur You're on the server already, right?

barisconur commented 2 years ago

@joschahenningsen I am not on the server. Could you please send dc server link? @kordianbruck When is the next team meeting?

joschahenningsen commented 2 years ago

@barisconur https://discord.gg/WSRzBkr7

Next meeting is scheduled for June, first @ 7PM

barisconur commented 2 years ago

Yes, we basically want to reimplement the current (closed source) api written in php. It might make sense to open source it to aid the progress here. Let's discuss this in the next team meeting (ping @kordianbruck)

Hello again. I am going to work on this migration endpoints in the next 2 weeks. How can I access the source code of old api written in php.

barisconur commented 2 years ago

Yes, we basically want to reimplement the current (closed source) api written in php. It might make sense to open source it to aid the progress here. Let's discuss this in the next team meeting (ping @kordianbruck)

Hello again. I am going to work on this migration endpoints in the next 2 weeks. How can I access the source code of old api written in php.

Additionally, I created a new branch and I am trying to push it to the repo but it throws the error below. remote: Permission to TUM-Dev/Campus-Backend.git denied to barisconur. fatal: unable to access 'https://github.com/TUM-Dev/Campus-Backend.git/': The requested URL returned error: 403

tobiasjungmann commented 2 years ago

You can not directly push to this repository if you are not a member. Instead you have to fork the repository, clone your fork (or set the git parameters in the version you have downloaded at the moment). Then you can push commits to your forked repo. These commits can then be added with a Pull Request from your forked repo to this repository.

barisconur commented 2 years ago

@tobiasjungmann I am stuck at connecting my local database. I created a mariadb running container with: docker run --detach \ --name mariadb-tum-backend \ --env MARIADB_USER=root \ --env MARIADB_ROOT_PASSWORD=example \ --restart always \ -p 3306:3306 \ --volume "$(pwd)"/init.sql:/init.sql \ mariadb:latest --init-file /init.sql

I am able to connect it via DataGrip but I am not sure how to connect it in main.go. I tried: // main.go line 49-50 // conn = sqlite.Open("test.db") conn = mysql.Open("jdbc:mariadb://localhost:3306")

joschahenningsen commented 2 years ago

@barisconur no need to modify the code. To connect to the local mariadb you have to add the database connection string (root:example@tcp(localhost:3306)/tca-portal?charset=utf8mb4&parseTime=True&loc=Local) to your environment variables like this:

image image image

barisconur commented 2 years ago

@barisconur no need to modify the code. To connect to the local mariadb you have to add the database connection string (root:example@tcp(localhost:3306)/tca-portal?charset=utf8mb4&parseTime=True&loc=Local) to your environment variables like this:

image image image

Hello, It throws this error: image

I also tried with: root:example@tcp(localhost:3306)/mariadb-tum-backend?charset=utf8mb4&parseTime=True&loc=Local

I changed tca_portal to mariadb-tum-backend.

joschahenningsen commented 2 years ago

Not sure if you successfully imported the database schema. If not, open the database connection in dataGrip, create a new query console, run CREATE DATABASE tca-portal; and then run this script on the database: https://raw.githubusercontent.com/TUM-Dev/Campus-Backend/db-models/model/souce-schema.sql

barisconur commented 2 years ago

https://raw.githubusercontent.com/TUM-Dev/Campus-Backend/db-models/model/souce-schema.sql

Thanks. But it gives sql syntax error for "CREATE DATABASE tca-portal;". So I changed it to "tca_portal". But then the script threw some errors afterwards.

image image