초기커밋
This commit is contained in:
8
UGQDatabase/Directory.Build.props
Normal file
8
UGQDatabase/Directory.Build.props
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<BaseIntermediateOutputPath>..\..\obj\AnyCPU\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
<BaseOutputPath>..\..\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
528
UGQDatabase/FakeDataScript/insert_fake_data.py
Normal file
528
UGQDatabase/FakeDataScript/insert_fake_data.py
Normal file
@@ -0,0 +1,528 @@
|
||||
import uuid
|
||||
from pymongo import MongoClient
|
||||
from faker import Faker
|
||||
import json
|
||||
import datetime
|
||||
import random
|
||||
from pymongo import ReturnDocument
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class QuestContentState(Enum):
|
||||
NoneState = 0
|
||||
Editable = 1
|
||||
Test = 2
|
||||
Standby = 3
|
||||
Live = 4
|
||||
Shutdown = 5
|
||||
|
||||
class CreatorPointHistoryKind(Enum):
|
||||
NoneKind = 0
|
||||
QuestProfit = 1
|
||||
AvatarReceived = 2
|
||||
CashReceived = 3
|
||||
|
||||
def random_datetime():
|
||||
year = random.randrange(2019,2025)
|
||||
month = random.randrange(1,13)
|
||||
day = random.randrange(1,28)
|
||||
hour = random.randrange(0,24)
|
||||
minute = random.randrange(0, 60)
|
||||
second = random.randrange(0, 60)
|
||||
return datetime.datetime(year, month, day, hour, minute, second)
|
||||
|
||||
|
||||
def drop_all():
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
like_collection = ugq_db.get_collection("Like")
|
||||
bookmark_collection = ugq_db.get_collection("Bookmark")
|
||||
cp_history_collection = ugq_db.get_collection("CreatorPointHistory")
|
||||
|
||||
quest_accepted_collection = ugq_db.get_collection("QuestAccepted")
|
||||
quest_aborted_collection = ugq_db.get_collection("QuestAborted")
|
||||
quest_completed_collection = ugq_db.get_collection("QuestCompleted")
|
||||
report_collection = ugq_db.get_collection("Report")
|
||||
|
||||
account_collection.drop()
|
||||
quest_content_collection.drop()
|
||||
like_collection.drop()
|
||||
bookmark_collection.drop()
|
||||
cp_history_collection.drop()
|
||||
quest_accepted_collection.drop()
|
||||
quest_aborted_collection.drop()
|
||||
quest_completed_collection.drop()
|
||||
report_collection.drop()
|
||||
|
||||
pass
|
||||
|
||||
def init():
|
||||
quest_sequence = ugq_db.get_collection("QuestIdSequence")
|
||||
|
||||
filter = {"_id": "QuestId" }
|
||||
|
||||
found_doc = quest_sequence.find_one(filter)
|
||||
if found_doc is None:
|
||||
doc = {
|
||||
"_id": "QuestId",
|
||||
"Sequence": 0,
|
||||
"CreatedAt": datetime.datetime.now(),
|
||||
"UpdatedAt": datetime.datetime.now(),
|
||||
}
|
||||
|
||||
ret = quest_sequence.insert_one(doc)
|
||||
print("QuestIdSequence: " + str(ret))
|
||||
|
||||
|
||||
|
||||
def get_next_quest_id(ugq_db):
|
||||
|
||||
quest_sequence = ugq_db.get_collection("QuestIdSequence")
|
||||
|
||||
filter = {"_id": "QuestId" }
|
||||
update = {
|
||||
'$inc': {'Sequence' : 1},
|
||||
'$set': {'UpdatedAt': datetime.datetime.now() }
|
||||
}
|
||||
|
||||
updated_doc = quest_sequence.find_one_and_update(
|
||||
filter, update,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
return updated_doc["Sequence"]
|
||||
|
||||
|
||||
def insert_fake_account(ugq_db, count):
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
# account_collection.drop()
|
||||
|
||||
fake_kr = Faker('ko_KR')
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
cp = random.randrange(1, 5000)
|
||||
|
||||
account_doc = {
|
||||
"UserGuid": str(uuid.uuid4()),
|
||||
"Nickname": fake_kr.name(),
|
||||
"AdditionalSlotCount": 0,
|
||||
"GradeType": "Amature",
|
||||
"CreatorPoint": cp,
|
||||
"CreatedAt": created_at,
|
||||
"UpdatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = account_collection.insert_one(account_doc)
|
||||
print("Account: " + str(ret))
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def insert_fake_quest_tasks(ugq_db, quest_content_id):
|
||||
pass
|
||||
|
||||
|
||||
def insert_fake_quest_content(ugq_db):
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
# quest_content_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
accounts = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
accounts.append({
|
||||
"UserGuid": document["UserGuid"],
|
||||
"Nickname": document["Nickname"]
|
||||
})
|
||||
|
||||
fake_en = Faker('en_US')
|
||||
fake_kr = Faker('ko_KR')
|
||||
fake_jp = Faker('ja_JP')
|
||||
for account in accounts:
|
||||
|
||||
create_count = random.randrange(1, 3)
|
||||
for i in range(create_count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
quest_id = get_next_quest_id(ugq_db)
|
||||
revision = random.randrange(1, 1000)
|
||||
cost = random.randrange(100, 5000)
|
||||
|
||||
beacon_id = random.randrange(1001, 1059)
|
||||
|
||||
randValue = random.randrange(0, len(QuestContentState))
|
||||
state = QuestContentState(randValue).name
|
||||
if randValue == 0:
|
||||
state = "None"
|
||||
|
||||
quest_content_doc = {
|
||||
"UserGuid": account["UserGuid"],
|
||||
"Author": account["Nickname"],
|
||||
"GradeType": "Amature",
|
||||
"QuestId": quest_id,
|
||||
"Revision": revision,
|
||||
"BeaconId": beacon_id,
|
||||
"Title": {
|
||||
"Kr": fake_kr.company(),
|
||||
"En": fake_en.company(),
|
||||
"Jp": fake_jp.company(),
|
||||
},
|
||||
"Langs": ["en", "kr", "jp"],
|
||||
"UploadCounter": 0,
|
||||
"TitleImagePath": "",
|
||||
"BannerImagePath": "",
|
||||
"Description": {
|
||||
"Kr": fake_kr.catch_phrase(),
|
||||
"En": fake_en.catch_phrase(),
|
||||
"Jp": fake_jp.catch_phrase(),
|
||||
},
|
||||
"State": "Live",
|
||||
"Cost": cost,
|
||||
"Tasks": [],
|
||||
"CreatedAt": created_at,
|
||||
"UpdatedAt": created_at,
|
||||
"IsDeleted": False,
|
||||
"DeletedAt": datetime.datetime(1, 1, 1)
|
||||
}
|
||||
|
||||
# print(quest_content_doc)
|
||||
ret = quest_content_collection.insert_one(quest_content_doc)
|
||||
print("QuestContent: " + str(ret))
|
||||
# for account in accounts:
|
||||
|
||||
|
||||
def insert_fake_like(ugq_db):
|
||||
|
||||
like_collection = ugq_db.get_collection("Like")
|
||||
# like_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append(document["QuestId"])
|
||||
|
||||
for user_guid in user_guids:
|
||||
|
||||
quest_ids_copy = quest_ids.copy()
|
||||
random.shuffle(quest_ids_copy)
|
||||
|
||||
count = random.randrange(1, len(quest_ids_copy))
|
||||
|
||||
for i in range(count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
like_doc = {
|
||||
"QuestId": quest_ids_copy[i],
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = like_collection.insert_one(like_doc)
|
||||
print("Like: " + str(ret))
|
||||
# for i in range(count):
|
||||
|
||||
# for user_guid in user_guids:
|
||||
|
||||
|
||||
def insert_fake_bookmark(ugq_db):
|
||||
|
||||
bookmark_collection = ugq_db.get_collection("Bookmark")
|
||||
# bookmark_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append(document["QuestId"])
|
||||
|
||||
for user_guid in user_guids:
|
||||
|
||||
quest_ids_copy = quest_ids.copy()
|
||||
random.shuffle(quest_ids_copy)
|
||||
|
||||
count = random.randrange(1, len(quest_ids_copy))
|
||||
|
||||
for i in range(count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
bookmark_doc = {
|
||||
"QuestId": quest_ids_copy[i],
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = bookmark_collection.insert_one(bookmark_doc)
|
||||
print("Bookmark: " + str(ret))
|
||||
# for i in range(count):
|
||||
|
||||
# for user_guid in user_guids:
|
||||
|
||||
|
||||
def insert_fake_creator_point_history(ugq_db):
|
||||
|
||||
cp_history_collection = ugq_db.get_collection("CreatorPointHistory")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(1, len(CreatorPointHistoryKind))
|
||||
kind = CreatorPointHistoryKind(randValue).name
|
||||
|
||||
amount = 0
|
||||
if kind == "QuestProfit":
|
||||
amount = random.randrange(1, 5000)
|
||||
else:
|
||||
amount = -random.randrange(1, 5000)
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
cp_history_doc = {
|
||||
"UserGuid": user_guid,
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"Kind": kind,
|
||||
"DetailReason": "",
|
||||
"Amount": amount,
|
||||
"TotalAmount": amount,
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = cp_history_collection.insert_one(cp_history_doc)
|
||||
print("CreatorPointHistory: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_accepted(ugq_db):
|
||||
|
||||
quest_accepted_collection = ugq_db.get_collection("QuestAccepted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
accepted_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Reason": "Player",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_accepted_collection.insert_one(accepted_doc)
|
||||
print("QuestAccepted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_aborted(ugq_db):
|
||||
|
||||
quest_aborted_collection = ugq_db.get_collection("QuestAborted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
aborted_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Reason": "Player",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_aborted_collection.insert_one(aborted_doc)
|
||||
print("QuestAborted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_completed(ugq_db):
|
||||
|
||||
quest_completed_collection = ugq_db.get_collection("QuestCompleted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
completed_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_completed_collection.insert_one(completed_doc)
|
||||
print("QuestCompleted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_report(ugq_db):
|
||||
|
||||
report_collection = ugq_db.get_collection("Report")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
report_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Content": "신고고고곡",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = report_collection.insert_one(report_doc)
|
||||
print("Report: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
conn_string = "mongodb://root:root@127.0.0.1:27017"
|
||||
|
||||
client = MongoClient(conn_string)
|
||||
|
||||
ugq_db = client['UGQ']
|
||||
|
||||
drop_all()
|
||||
init()
|
||||
|
||||
insert_fake_account(ugq_db, 100)
|
||||
insert_fake_quest_content(ugq_db)
|
||||
|
||||
insert_fake_like(ugq_db)
|
||||
insert_fake_bookmark(ugq_db)
|
||||
|
||||
insert_fake_creator_point_history(ugq_db)
|
||||
insert_fake_quest_accepted(ugq_db)
|
||||
insert_fake_quest_aborted(ugq_db)
|
||||
insert_fake_quest_completed(ugq_db)
|
||||
insert_fake_report(ugq_db)
|
||||
|
||||
133
UGQDatabase/FakeDataScript/insert_quest.py
Normal file
133
UGQDatabase/FakeDataScript/insert_quest.py
Normal file
@@ -0,0 +1,133 @@
|
||||
import uuid
|
||||
import json
|
||||
import datetime
|
||||
import argparse
|
||||
import requests
|
||||
import glob, os
|
||||
import sys
|
||||
import re
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
def change_state(server_address, access_token, quest_content_id, state):
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{quest_content_id}?state={state}"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}"
|
||||
}
|
||||
|
||||
response = session.patch(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
return response
|
||||
|
||||
|
||||
def delete_all_quest(server_address, access_token):
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/summaries"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}"
|
||||
}
|
||||
|
||||
response = session.get(api_url, headers=headers)
|
||||
|
||||
for quest in response.json()["summaries"]:
|
||||
questContentId = quest["questContentId"]
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest/{questContentId}"
|
||||
response = session.delete(api_url, headers=headers)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
parser = argparse.ArgumentParser(prog='insert-quest', description='insert quest')
|
||||
parser.add_argument('--env', required=True, type=str, help=f'')
|
||||
parser.add_argument('--login_id', required=True, type=str, help=f'')
|
||||
parser.add_argument('--folder', required=True, type=str, help=f'')
|
||||
args = parser.parse_args()
|
||||
|
||||
print(args.env)
|
||||
print(args.login_id)
|
||||
print(args.folder)
|
||||
|
||||
server_address = ""
|
||||
if args.env == "local":
|
||||
server_address="http://localhost:11000/"
|
||||
elif args.env == "aws":
|
||||
server_address="https://dev-ugqapi.caliverse.io:11000"
|
||||
|
||||
print(f'server_address: {server_address}')
|
||||
|
||||
api_url = f"{server_address}/api/v1/Account/dev-login-v2"
|
||||
body = {
|
||||
"loginAccountId": args.login_id
|
||||
}
|
||||
|
||||
response = session.post(api_url, json=body)
|
||||
|
||||
access_token = response.json()["accessToken"]
|
||||
user_guid = response.json()["userGuid"]
|
||||
|
||||
print(access_token)
|
||||
|
||||
delete_all_quest(server_address, access_token)
|
||||
|
||||
questContentId = ""
|
||||
with open(f'{args.folder}/QuestContent.json', encoding='utf-8') as json_file:
|
||||
json_data = json.load(json_file)
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
"accept-language": "ko"
|
||||
}
|
||||
response = session.post(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
questContentId = response.json()["questContentId"]
|
||||
|
||||
for file in glob.glob(f"{args.folder}/QuestDialog*.json"):
|
||||
with open(file, encoding='utf-8') as json_file:
|
||||
json_data = json.load(json_file)
|
||||
|
||||
result = re.search('\\[(.*)\\]', file)
|
||||
index = result.group(1)
|
||||
print(f"{file} -> {index}")
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-dialog/{questContentId}?taskIndex={index}"
|
||||
response = session.post(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-image/{questContentId}?titleImageId=1&bannerImageId=2"
|
||||
response = session.post(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{questContentId}?state=Test"
|
||||
response = session.patch(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
quest_id = response.json()["questId"]
|
||||
revision = response.json()["revision"]
|
||||
|
||||
## ingame api
|
||||
api_url = f"{server_address}/api/v1/InGame/set-test-completed/{user_guid}?questId={quest_id}&revision={revision}"
|
||||
response = session.post(api_url)
|
||||
|
||||
## web api
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{questContentId}?state=Live"
|
||||
response = session.patch(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
change_state(server_address, access_token, questContentId, "Standby")
|
||||
change_state(server_address, access_token, questContentId, "Editable")
|
||||
response = change_state(server_address, access_token, questContentId, "Test")
|
||||
|
||||
questContentId = response.json()["questContentId"]
|
||||
quest_id = response.json()["questId"]
|
||||
revision = response.json()["revision"]
|
||||
|
||||
api_url = f"{server_address}/api/v1/InGame/set-test-completed/{user_guid}?questId={quest_id}&revision={revision}"
|
||||
response = session.post(api_url)
|
||||
|
||||
change_state(server_address, access_token, questContentId, "Live")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
6
UGQDatabase/FakeDataScript/requirements.txt
Normal file
6
UGQDatabase/FakeDataScript/requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# Needed modules
|
||||
|
||||
|
||||
faker
|
||||
requests
|
||||
|
||||
62
UGQDatabase/FakeDataScript/sample1/QuestContent.json
Normal file
62
UGQDatabase/FakeDataScript/sample1/QuestContent.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"BeaconId": 1002,
|
||||
"Title": {
|
||||
"Kr": "장장안",
|
||||
"En": "Simmons and Sons",
|
||||
"Jp": "有限?社福田銀行"
|
||||
},
|
||||
"Languages": [
|
||||
"en",
|
||||
"kr",
|
||||
"jp"
|
||||
],
|
||||
"Description": {
|
||||
"Kr": "완벽히 설정된 로컬 포탈",
|
||||
"En": "Organic leadingedge encoding",
|
||||
"Jp": "Open-architected disintermediate Graphic Interface"
|
||||
},
|
||||
"State": "Live",
|
||||
"Cost": 0,
|
||||
"Tasks": [
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "아스트라와 대화하기",
|
||||
"En": "Talk to Astra",
|
||||
"Jp": "Talk to Astra"
|
||||
},
|
||||
"ActionId": 1,
|
||||
"ActionValue": 1002,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "에셀셜 반팔티셔츠 사기",
|
||||
"En": "buy_item",
|
||||
"Jp": "buy_item"
|
||||
},
|
||||
"ActionId": 3,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "에센셜 반팔 티셔츠 입기",
|
||||
"En": "에센셜 반팔 티셔츠 입기(영문)",
|
||||
"Jp": "에센셜 반팔 티셔츠 입기(일어)"
|
||||
},
|
||||
"ActionId": 2,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "펠트 울 재킷 팔기",
|
||||
"En": "펠트 울 재킷 팔기(영문)",
|
||||
"Jp": "펠트 울 재킷 팔기(일어)"
|
||||
},
|
||||
"ActionId": 4,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[0].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[0].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": -1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[1].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[1].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[2].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[2].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
UGQDatabase/FakeDataScript/사용법.txt
Normal file
2
UGQDatabase/FakeDataScript/사용법.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
python .\insert_quest.py --env=local --login_id=spooky000 --folder=sample1
|
||||
python .\insert_quest.py --env=aws --login_id=spooky000 --folder=sample1
|
||||
37
UGQDatabase/Models/AccountEntity.cs
Normal file
37
UGQDatabase/Models/AccountEntity.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public class AccountEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
public string Nickname { get; set; } = null!;
|
||||
|
||||
public string? AccountId { get; set; }
|
||||
|
||||
// TODO: not null
|
||||
public string? RefreshToken { get; set; }
|
||||
public DateTime? RefreshTokenExpiryTime { get; set; }
|
||||
|
||||
public int AdditionalSlotCount { get; set; }
|
||||
public int? SlotCountVersion { get; set; }
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UgqGradeType GradeType { get; set; } = UgqGradeType.Amature;
|
||||
|
||||
public double CreatorPoint { get; set; } = 0;
|
||||
public int? CreatorPointVersion { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
35
UGQDatabase/Models/AdminAccountEntity.cs
Normal file
35
UGQDatabase/Models/AdminAccountEntity.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public enum UGQAccountRole
|
||||
{
|
||||
None = 0,
|
||||
Admin = 1,
|
||||
Service = 2,
|
||||
User = 3,
|
||||
}
|
||||
|
||||
public class AdminAccountEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
public string Password { get; set; } = null!;
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UGQAccountRole Role { get; set; }
|
||||
|
||||
public string RefreshToken { get; set; } = null!;
|
||||
public DateTime RefreshTokenExpiryTime { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
19
UGQDatabase/Models/BookmarkEntity.cs
Normal file
19
UGQDatabase/Models/BookmarkEntity.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public class BookmarkEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
40
UGQDatabase/Models/CreatorPointHistoryEntity.cs
Normal file
40
UGQDatabase/Models/CreatorPointHistoryEntity.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public enum CreatorPointHistoryKind
|
||||
{
|
||||
None = 0,
|
||||
QuestProfit = 1,
|
||||
SettleUp = 2,
|
||||
Admin = 3,
|
||||
}
|
||||
|
||||
public class CreatorPointHistoryEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public CreatorPointHistoryKind Kind { get; set; }
|
||||
|
||||
public string DetailReason { get; set; } = null!;
|
||||
|
||||
public double Amount { get; set; }
|
||||
|
||||
public double TotalAmount { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
64
UGQDatabase/Models/GameQuestDataEntity.cs
Normal file
64
UGQDatabase/Models/GameQuestDataEntity.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public class GameQuestDialogDataEntity
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
public List<DialogSequenceEntity> Sequences { get; set; } = new();
|
||||
}
|
||||
|
||||
public class GameQuestDataEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
public string Author { get; set; } = null!;
|
||||
|
||||
public int BeaconId { get; set; }
|
||||
public string? UgcBeaconGuid { get; set; }
|
||||
public string? UgcBeaconNickname { get; set; }
|
||||
|
||||
public TextEntity Title { get; set; } = new TextEntity();
|
||||
public List<string> Langs { get; set; } = new List<string>();
|
||||
public string TitleImagePath { get; set; } = string.Empty;
|
||||
public string BannerImagePath { get; set; } = string.Empty;
|
||||
public TextEntity Description { get; set; } = new TextEntity();
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UgqGradeType GradeType { get; set; } = UgqGradeType.Amature;
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public QuestContentState State { get; set; }
|
||||
public int Cost { get; set; }
|
||||
|
||||
public bool Shutdown { get; set; }
|
||||
|
||||
public List<TaskEntity> Tasks { get; set; } = new ();
|
||||
public List<GameQuestDialogDataEntity> Dialogs { get; set; } = new();
|
||||
|
||||
public List<QuestMetaInfo> QuestScriptMetas { get; set; } = new(); //클라에게 바로 전달 해주기 위해 Tasks를 가공한 Meta 정보
|
||||
|
||||
public UgqGameQuestDataForClient UgqGameQuestDataForClient { get; set; } = new(); //클라에게 바로 전달해주기 위해 Dialogs 를 가공한 데이터
|
||||
public string UgqGameQuestDataForClientString { get; set; } = string.Empty; //클라에게 바로 전달해주기 위해 Dialogs 를 가공한 데이터 문자열
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
}
|
||||
|
||||
21
UGQDatabase/Models/LikeEntity.cs
Normal file
21
UGQDatabase/Models/LikeEntity.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public class LikeEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
}
|
||||
|
||||
19
UGQDatabase/Models/NpcNameEntity.cs
Normal file
19
UGQDatabase/Models/NpcNameEntity.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public class NpcNameEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public int NpcId { get; set; }
|
||||
public TextEntity NpcName { get; set; } = new TextEntity();
|
||||
}
|
||||
37
UGQDatabase/Models/QuestAboartedEntity.cs
Normal file
37
UGQDatabase/Models/QuestAboartedEntity.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public enum UGQAbortReason
|
||||
{
|
||||
None = 0,
|
||||
Player = 1,
|
||||
RevisionUpdated = 2,
|
||||
Shutdown = 3,
|
||||
}
|
||||
|
||||
public class QuestAbortedEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
public string Author { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UGQAbortReason Reason { get; set; } = UGQAbortReason.None;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
36
UGQDatabase/Models/QuestAcceptedEntity.cs
Normal file
36
UGQDatabase/Models/QuestAcceptedEntity.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public enum UGQAcceptReason
|
||||
{
|
||||
None = 0,
|
||||
Player = 1,
|
||||
RevisionUpdated = 2,
|
||||
}
|
||||
|
||||
public class QuestAcceptedEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
public string Author { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UGQAcceptReason Reason { get; set; } = UGQAcceptReason.None;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
26
UGQDatabase/Models/QuestCompletedEntity.cs
Normal file
26
UGQDatabase/Models/QuestCompletedEntity.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public class QuestCompletedEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
public string Author { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
82
UGQDatabase/Models/QuestContentEntity.cs
Normal file
82
UGQDatabase/Models/QuestContentEntity.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public enum QuestContentState
|
||||
{
|
||||
None = 0,
|
||||
Uncomplate = 1,
|
||||
Editable = 2,
|
||||
Test = 3,
|
||||
Standby = 4,
|
||||
Live = 5,
|
||||
Shutdown = 6,
|
||||
}
|
||||
|
||||
|
||||
public class TaskEntity
|
||||
{
|
||||
public TextEntity GoalText { get; set; } = new TextEntity();
|
||||
public int ActionId { get; set; }
|
||||
public int ActionValue { get; set; }
|
||||
public bool IsShowNpcLocation { get; set; }
|
||||
public string? UgcActionValueGuid { get; set; }
|
||||
public string? UgcActionValueName { get; set; }
|
||||
public string? DialogId { get; set; }
|
||||
}
|
||||
|
||||
public class QuestContentEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
public string Author { get; set; } = null!;
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public UgqGradeType GradeType { get; set; } = UgqGradeType.Amature;
|
||||
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
|
||||
public int BeaconId { get; set; }
|
||||
public string? UgcBeaconGuid { get; set; }
|
||||
public string? UgcBeaconNickname { get; set; }
|
||||
|
||||
public TextEntity Title { get; set; } = new TextEntity();
|
||||
|
||||
public List<string>? Tags { get; set; }
|
||||
public List<string> Langs { get; set; } = new List<string>();
|
||||
|
||||
public int UploadCounter { get; set; }
|
||||
public string TitleImagePath { get; set; } = string.Empty;
|
||||
public string BannerImagePath { get; set; } = string.Empty;
|
||||
public TextEntity Description { get; set; } = new TextEntity();
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public QuestContentState State { get; set; }
|
||||
|
||||
public bool? ToNextRevision { get; set; } = false;
|
||||
public int Cost { get; set; }
|
||||
|
||||
public string Savelanguage { get; set; } = string.Empty;
|
||||
|
||||
public List<TaskEntity> Tasks { get; set; } = new List<TaskEntity>();
|
||||
|
||||
public int? ContentVersion { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
public DateTime DeletedAt { get; set; } = DateTime.MinValue;
|
||||
}
|
||||
|
||||
54
UGQDatabase/Models/QuestDialogEntity.cs
Normal file
54
UGQDatabase/Models/QuestDialogEntity.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public class TextEntity
|
||||
{
|
||||
public string Kr { get; set; } = string.Empty;
|
||||
public string En { get; set; } = string.Empty;
|
||||
public string Jp { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public enum DialogTalker
|
||||
{
|
||||
Player = 0,
|
||||
Npc = 1,
|
||||
}
|
||||
|
||||
|
||||
public class DialogSequenceActionEntity
|
||||
{
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public DialogTalker Talker { get; set; }
|
||||
public int Type { get; set; }
|
||||
public TextEntity Talk { get; set; } = new TextEntity();
|
||||
public int Condition { get; set; }
|
||||
public int ConditionValue { get; set; }
|
||||
public int NextSequence { get; set; }
|
||||
public int NpcAction { get; set; }
|
||||
}
|
||||
|
||||
public class DialogSequenceEntity
|
||||
{
|
||||
public int SequenceId { get; set; }
|
||||
public List<DialogSequenceActionEntity> Actions { get; set; } = new();
|
||||
}
|
||||
|
||||
|
||||
public class QuestDialogEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public List<DialogSequenceEntity> Sequences { get; set; } = new();
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
|
||||
|
||||
19
UGQDatabase/Models/QuestIdSequenceEntity.cs
Normal file
19
UGQDatabase/Models/QuestIdSequenceEntity.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public class QuestIdSequenceEntity
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long Sequence { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
|
||||
23
UGQDatabase/Models/ReportEntity.cs
Normal file
23
UGQDatabase/Models/ReportEntity.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
|
||||
public class ReportEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long QuestId { get; set; }
|
||||
public long Revision { get; set; }
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
public string Contents { get; set; } = null!;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
}
|
||||
|
||||
31
UGQDatabase/Models/ReserveAccountGradeEntity.cs
Normal file
31
UGQDatabase/Models/ReserveAccountGradeEntity.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UGQDatabase.Models;
|
||||
|
||||
public class ReserveAccountGradeEntity
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public string UserGuid { get; set; } = null!;
|
||||
|
||||
[BsonRepresentation(BsonType.Int32)]
|
||||
public UgqGradeType BeforeGradeType { get; set; } = UgqGradeType.Amature;
|
||||
|
||||
[BsonRepresentation(BsonType.Int32)]
|
||||
public UgqGradeType ReserveGradeType { get; set; } = UgqGradeType.Amature;
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime ReserveTime { get; set; }
|
||||
|
||||
[BsonRequired]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public bool IsCompleted { get; set; }
|
||||
}
|
||||
20
UGQDatabase/UGQDatabase.csproj
Normal file
20
UGQDatabase/UGQDatabase.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;Shipping</Configurations>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Bson" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Protocol\Protocol.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user