-
Notifications
You must be signed in to change notification settings - Fork 0
Уведомления в телеграмме #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Zamelane
wants to merge
12
commits into
main
Choose a base branch
from
notifications-tg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9c9dd97
Набросать отправку уведомлений об оценках в телеграм
Zamelane ea88bc2
Дописать отправку уведомлений об оценках для основных действий
Zamelane dca8854
Убрать скобки для эмодзи
Zamelane e8539fb
Правки в оформлении
Zamelane ee9ad0d
Подготовка к полноценной подписке на уведомления
Zamelane 1c6ccf6
Подготовка к полноценной подписке на уведомления
Zamelane ccc9b5a
Переписать на puregram
Zamelane 04e6b42
Маленький баг )))
Zamelane 74d5155
Update sendMarkEvent.ts
Zamelane 80e4cb6
Какие-то правки, чтобы бот не зависал (ну и пробуем отлавливать, что …
Zamelane d34f422
Исправить способ проверки воркера
Zamelane f0bfd32
Переход на mtcute
Zamelane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let isWorker = false | ||
|
||
export const setIsWorker = (value: boolean) => (isWorker = value) | ||
|
||
export const getIsWorker = () => isWorker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './markGetByData' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { ICacheData } from '@helpers' | ||
import { MarkModel } from '../../model' | ||
|
||
export const markGetByData = async (taskId: bigint, authData: ICacheData) => | ||
MarkModel.findOne({ | ||
where: { | ||
taskId, | ||
diaryUserId: authData.localUserId | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './save' | ||
export * from './delete' | ||
export * from './get' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/api/src/models/MarkValue/actions/get/markValueGetById.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { MarkValueModel } from '../../model' | ||
|
||
export const markValueGetById = async (markValueId: number) => | ||
MarkValueModel.findOne({ | ||
where: { | ||
id: markValueId | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './requiredGetByData' |
9 changes: 9 additions & 0 deletions
9
apps/api/src/models/Required/actions/get/requiredGetByData.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { RequiredModel } from '../../model' | ||
|
||
export const requiredGetByData = (diaryUserId: bigint, taskId: bigint) => | ||
RequiredModel.findOne({ | ||
where: { | ||
diaryUserId, | ||
taskId | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './save' | ||
export * from './get' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './scheduleGetFromDB' | ||
export * from './scheduleGetFromDBById' |
8 changes: 8 additions & 0 deletions
8
apps/api/src/models/Schedule/actions/get/scheduleGetFromDBById.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ScheduleModel } from '../../model' | ||
|
||
export const scheduleGetFromDBById = async (scheduleId: bigint) => | ||
ScheduleModel.findOne({ | ||
where: { | ||
id: scheduleId | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './subjectGetFromDBById' |
8 changes: 8 additions & 0 deletions
8
apps/api/src/models/Subject/actions/get/subjectGetFromDBById.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { SubjectModel } from '../../model' | ||
|
||
export const subjectGetFromDBById = (subjectId: bigint) => | ||
SubjectModel.findOne({ | ||
where: { | ||
id: subjectId | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './save' | ||
export * from './get' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './model' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { DataTypes } from 'sequelize' | ||
|
||
import { cache, enableCache, sequelize } from '@db' | ||
|
||
import { DiaryUserModel } from '../DiaryUser' | ||
import type { IModelPrototypeNoId } from '../types' | ||
|
||
export type SubscribeModelType = { | ||
diaryUserId: bigint | ||
tgId: bigint | ||
preActionsIsSuccess: boolean | ||
} | ||
|
||
export type ISubscribeModelType = IModelPrototypeNoId<SubscribeModelType> | ||
|
||
const subscribeModel = sequelize.define<ISubscribeModelType>('subscribe', { | ||
diaryUserId: { | ||
type: DataTypes.BIGINT, | ||
primaryKey: true, | ||
references: { | ||
model: DiaryUserModel, | ||
key: 'id' | ||
} | ||
}, | ||
tgId: { | ||
type: DataTypes.BIGINT, | ||
primaryKey: true, | ||
allowNull: false, | ||
unique: true | ||
}, | ||
preActionsIsSuccess: { | ||
type: DataTypes.BOOLEAN, | ||
primaryKey: false, | ||
allowNull: false, | ||
unique: false | ||
} | ||
}) | ||
|
||
export const SubscribeModel = enableCache | ||
? cache.init<ISubscribeModelType>(subscribeModel) | ||
: subscribeModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './taskGetFromDB' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { TaskModel } from '../../model' | ||
|
||
export const taskGetFromDB = async (taskIdFromDiary: number) => | ||
TaskModel.findOne({ | ||
where: { | ||
idFromDiary: taskIdFromDiary | ||
} | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './delete' | ||
export * from './get' | ||
export * from './save' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove