mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
publish: 5.7.8
This commit is contained in:
parent
2d0d018ba5
commit
f9f72c3c1a
5 changed files with 38 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "royalpack"
|
name = "royalpack"
|
||||||
version = "5.7.7"
|
version = "5.7.8"
|
||||||
description = "A Royalnet command pack for the Royal Games community"
|
description = "A Royalnet command pack for the Royal Games community"
|
||||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -13,6 +13,7 @@ from .api_diario_random import ApiDiarioRandomStar
|
||||||
from .api_polls_create import ApiPollsCreate
|
from .api_polls_create import ApiPollsCreate
|
||||||
from .api_polls_get import ApiPollsGet
|
from .api_polls_get import ApiPollsGet
|
||||||
from .api_polls_list import ApiPollsList
|
from .api_polls_list import ApiPollsList
|
||||||
|
from .api_cvstats_latest import ApiCvstatsLatestStar
|
||||||
|
|
||||||
# Enter the PageStars of your Pack here!
|
# Enter the PageStars of your Pack here!
|
||||||
available_page_stars = [
|
available_page_stars = [
|
||||||
|
@ -30,6 +31,7 @@ available_page_stars = [
|
||||||
ApiPollsCreate,
|
ApiPollsCreate,
|
||||||
ApiPollsGet,
|
ApiPollsGet,
|
||||||
ApiPollsList,
|
ApiPollsList,
|
||||||
|
ApiCvstatsLatestStar,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Don't change this, it should automatically generate __all__
|
# Don't change this, it should automatically generate __all__
|
||||||
|
|
21
royalpack/stars/api_cvstats_latest.py
Normal file
21
royalpack/stars/api_cvstats_latest.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import royalnet.utils as ru
|
||||||
|
from royalnet.backpack.tables import *
|
||||||
|
from royalnet.constellation.api import *
|
||||||
|
from ..tables import Cvstats
|
||||||
|
|
||||||
|
|
||||||
|
class ApiCvstatsLatestStar(ApiStar):
|
||||||
|
path = "/api/cvstats/latest/v1"
|
||||||
|
|
||||||
|
methods = ["GET"]
|
||||||
|
|
||||||
|
summary = "Get the latest 500 cvstats."
|
||||||
|
|
||||||
|
tags = ["cvstats"]
|
||||||
|
|
||||||
|
async def api(self, data: ApiData) -> ru.JSON:
|
||||||
|
CvstatsT = self.alchemy.get(Cvstats)
|
||||||
|
|
||||||
|
cvstats = data.session.query(CvstatsT).order_by(CvstatsT.timestamp.desc()).limit(500).all()
|
||||||
|
|
||||||
|
return list(map(lambda c: c.json(), cvstats))
|
|
@ -45,3 +45,16 @@ class Cvstats:
|
||||||
@declared_attr
|
@declared_attr
|
||||||
def users_total(self):
|
def users_total(self):
|
||||||
return Column(Integer)
|
return Column(Integer)
|
||||||
|
|
||||||
|
def json(self):
|
||||||
|
return {
|
||||||
|
"timestamp": self.timestamp.isoformat(),
|
||||||
|
"users_total": self.users_total,
|
||||||
|
"members_total": self.members_total,
|
||||||
|
"users_online": self.users_online,
|
||||||
|
"members_online": self.members_online,
|
||||||
|
"users_connected": self.users_connected,
|
||||||
|
"members_connected": self.members_connected,
|
||||||
|
"users_playing": self.users_playing,
|
||||||
|
"members_playing": self.members_playing,
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
semantic = "5.7.7"
|
semantic = "5.7.8"
|
||||||
|
|
Loading…
Reference in a new issue