Coder Social home page Coder Social logo

api's People

Contributors

sushiat avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

api's Issues

Add option to user account to disable country change protection for token renewal

The reason for this is that some users prefer using VPNs and switch countries on a regular basis and don't want to have to login again over and over

This will obviously not be the default and there should be a disclaimer in the settings section on the website/clients explaining that this degrades the security of the account

Expand DB cleanup

  • Payloads without job
  • Aircraft delivery locations without type
  • Flights without aircraft - replace with placeholder

Check for others too

Add authentication to api

  • API calls should use some form of token, most likely in the html header
  • Tokens should expire or not?
  • Add methods for registering accounts (from the website)
  • If possible support 2fa for logins if the user wants to, maybe require it for admins/moderators/va owners?
  • add email verification for new accounts (use existing [email protected] account used already by the forum)

[FR] Job-Populator

We need to implement a job-populator worker that generates jobs.
All distances are in nautical miles

These jobs can either be created "on demand" or whenever a import / job has finished.

Major issues that need to be solved when implementing this feature is:

  • Efficient way to get possible airports to generate jobs to the current airport
  • Caching for distances between airports (yes or no)
  • "Distance Categories" for different job types

Initial idea for categories were:

<50,  50-249 , 250-499, 500-999 , 1000-3000, > 3000

image

Add database cleanup worker

Create worker and add various clean up jobs over time
First one to add right now: Clean up expired OpenSky tokens

Create aircraft "world populator"

Based on airport size, number of parking spots and gates
Pick from available vanilla (for now) aircraft types and based on the airport location generate registrations based on icao naming rules with a few percent chosen randomly

Implement basic aircraft controller

Basic features for alpha, so players can find and buy planes to fly with

  • List aircraft at airport
  • List player aircraft
  • Purchase aircraft (without player money for now)
  • Return aircraft by registry

World populator extension

World populator is working fine but needs two small extensions:

  • Generated planes will need an initial fuel level
    • Add fuel column to Aircraft (in gallons, float should do nicely)
    • Initially add somewhere between 30-100% of fuel, to make sure plane isn't sitting with 0 fuel at an airport without refuelling - unless we want that for a challenge?, max gallons are on the aircraft type
  • Add helicopters (by request)
    • There are no heliports in our current datasource, but helicopters can obviously also fly to all the airports
    • There are currently only 2 mods that add helicopters, not sure how popular they are, so I'm not sure how many we should add via the world populator, maybe none for now, just extend the enum so we can add the types and just add 0's to the distribution matrix

Add airport classification system

Classify aiports from 0 (tiny) to 5 (international hub)
Based on airport / runway / approaches / ??? data imported from simulator

Add aircraft hours and maintenance history

  • Airframe and engine hours
  • Update hours from completed/aborted flights (return to destination)
  • Create history of maintenance performed for each aircraft, also determines when next check etc. is due
  • Apply random history to generated aircraft population? Or is this just wasting db space/performance?
  • Auto generated aircraft should pick random values for times from ~10% to 80% of usable before check

Add jobs and payloads

DB model

  • Jobs table
  • Payloads table
  • OpenSkyUser: add personal balance column
  • Add payloads to flights, aircraft and airports

Jobs controller

  • List jobs -> trigger job creation if none/not enough available
  • Accept jobs
  • Cancel jobs

Flight controller

  • Add payloads to flight planning
  • Add payloads to flight sent to agent
  • Finish flight check if payloads reached destination -> payout ๐Ÿ’ฐ

Add fuel type (override) to aircraft types

There are a few piston aircraft, especially from Diamond that use JetFuel instead of AvGas

  • Add new optional column to aircraft type, NULL means derive from engine type as currently implemented
  • Update agent aircraft type editor
  • Update client aircraft type editor

Add basic financial system

  • Balances for players and airlines
  • Financial transaction records
  • Update existing methods/controllers to create financial records and update balances correctly

Add data quality override system for moderators

  • Stored in separate table so they don't get lost when new dataimports get processed
  • Moderator tool page for client with add/edit/delete methods in API
  • Automatically triggered at the end of data import
  • Manually triggered from client interface

Create flight table and related controller

Guid
UserID/AirlineID(todo)
Flight number(random default)
AircraftID(can be null initially, so flights can be planned starting from aircrafts, jobs, etc.)
CrewIDs(players only for now, n:m table), add AI n:m table(s) later
CargoIDs(todo)
Origin
Destination
Alternate(todo how determine?)
Link to create Simbrief flight plan (airports, cargo etc.), maybe even download generated flight plan back into flight, so dispatchers can generate and attach flight plans(mega later todo)
Status -> Planning (initially), then follow the status reports from the agent (match with existing enum, or move server side so included in service contract)

started datetime, ground handling complete datetime (or minutes, check agent code for that)

Once flight is active save some additional fields:
lat/lon
radioheight
heading
airspeedtrue
onground

and for player flights also add these (for slew into position):
pitchangle
bankangle
verticalspeedseconds

also need to figure out efficient/elegant way of saving fuel tank levels, the sim has 11 tanks, would be best of we save/restore exactly back into the tanks. Or would be enough to just have the total gallons in a single field, in case of agent crash resume

Remove UTC offset

Don't enforce this at all anymore
Use instead small XP loss if TimeInSimChanged event is contained in flight log

Add aircraft types and aircraft

Add initial versions of those entities - enough to get to alpha
Design a basic "world aircraft population" worker that can (re)generate aircraft

Refresh authentication token fails when two request arrive at the same time

  1. Protect against that in the API and allow only one request per user at the same time
  2. Implement a similar check in the client(s) so that when a token expires and multiple requests are being sent, only one of them is triggering a token refresh and they all wait for the result
fail: OpenSky.API.Controllers.AuthenticationController[0]

      Error exchanging OpenSky token.

      Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

         at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)

         at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithoutPropagationAsync(Int32 commandIndex, RelationalDataReader reader, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

         at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

         at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

         at OpenSky.API.OpenSkyDbContext.SaveDatabaseChangesAsync(ILogger logger, String errorMessage) in /src/OpenSky.API/OpenSkyDbContext.cs:line 194

Flight payload job completion issue

  • Start flight: payload not on flight plan, ask user?
  • Complete flight: Payload aboard aircraft, check auto-unload and job complete
  • Ground handling: Unload cargo, check job complete

Create client-side "airport" package

Basic list with all airports

  • ICAO
  • Name
  • Size
  • LAT/LONG
  • ???

For drawing on the map, also for client-side distance calculations

Server creates this package either on request or after data import or some other logic?
Package then gets incremental version number or update timestamp.... client checks if new download is required during startup of application

Add support for dev api server

  • To allow developers to "mess" with the api, create a second instance running on https://api-dev.opensky.to/.
  • This version will have it's own database - that won't be persisted - maybe weekly resets?
  • This version will also disable certain feature like reCaptcha checks for account functions, so no website is necessary to use it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.