Skip to content

Commit

Permalink
rechore: client to strapiClient
Browse files Browse the repository at this point in the history
  • Loading branch information
luojiyin1987 committed Feb 26, 2024
1 parent 81f0ab8 commit 4395950
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions models/Activity/Award.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { User } from '@authing/native-js-ui-components';
import { ListModel, Stream, toggle } from 'mobx-restful';

import { Base, createListStream, InputData, Media } from '../Base';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';
import { Team } from './Team';

export interface Award
Expand All @@ -23,7 +23,7 @@ export interface AwardAssignment
}

export class AwardModel extends Stream<Award>(ListModel) {
client = sessionStore.client;
client = strapiClient;
currentAssignment?: AwardAssignmentModel;

constructor(baseURI: string) {
Expand Down Expand Up @@ -56,7 +56,7 @@ export class AwardModel extends Stream<Award>(ListModel) {
}

export class AwardAssignmentModel extends Stream<AwardAssignment>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/Enrollment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { buildURLData, countBy, groupBy } from 'web-utility';
import { Base, createListStream, Filter } from '../Base';
import { i18n } from '../Base/Translation';
import { User } from '../User';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';

const { t } = i18n;

Expand Down Expand Up @@ -40,7 +40,7 @@ export class EnrollmentModel extends Stream<Enrollment, EnrollmentFilter>(
this.baseURI = `${baseURI}/enrollment`;
}

client = sessionStore.client;
client = strapiClient;
indexKey = 'userId' as const;

@observable
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/Log.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IDType, ListModel, Stream } from 'mobx-restful';

import { Base, createListStream } from '../Base';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';

export interface Log extends Base {
operatorId: IDType;
Expand All @@ -11,7 +11,7 @@ export interface Log extends Base {
}

export class LogModel extends Stream<Log>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { buildURLData } from 'web-utility';

import { Base, createListStream, Filter, InputData } from '../Base';
import { i18n } from '../Base/Translation';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';

const { t } = i18n;

Expand All @@ -23,7 +23,7 @@ export interface Message extends Base {
export type MessageFilter = Filter<Message>;

export class MessageModel extends Stream<Message, MessageFilter>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { groupBy } from 'web-utility';

import { Base, createListStream, InputData, Media } from '../Base';
import { i18n } from '../Base/Translation';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';

const { t } = i18n;

Expand Down Expand Up @@ -33,7 +33,7 @@ export interface Organization extends Base {
}

export class OrganizationModel extends Stream<Organization>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(public baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/Staff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { groupBy, mergeStream } from 'web-utility';

import { Base, createListStream, InputData } from '../Base';
import { User } from '../User';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';

export interface HackathonAdmin
extends Base,
Expand All @@ -17,7 +17,7 @@ export interface Staff extends HackathonAdmin {
}

export class StaffModel extends Stream<Staff>(ListModel) {
client = sessionStore.client;
client = strapiClient;
indexKey = 'userId' as const;

constructor(public baseURI: string) {
Expand Down
10 changes: 5 additions & 5 deletions models/Activity/Team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../Base';
import { WorkspaceModel } from '../Git';
import { User } from '../User';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';
import { AwardAssignment } from './Award';
import { NameAvailability } from './index';

Expand Down Expand Up @@ -74,7 +74,7 @@ export class TeamModel extends Stream<Team, TeamFilter>(ListModel) {
this.baseURI = `${baseURI}/team`;
}

client = sessionStore.client;
client = strapiClient;
currentMember?: TeamMemberModel;
currentWork?: TeamWorkModel;
currentWorkspace?: WorkspaceModel;
Expand Down Expand Up @@ -182,7 +182,7 @@ export class TeamMemberModel extends Stream<TeamMember, Filter<TeamMember>>(
this.baseURI = `${baseURI}/member`;
}

client = sessionStore.client;
client = strapiClient;

@observable
accessor sessionOne: TeamMember | undefined;
Expand Down Expand Up @@ -226,7 +226,7 @@ export class TeamMemberModel extends Stream<TeamMember, Filter<TeamMember>>(
}

export class TeamWorkModel extends Stream<TeamWork>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand All @@ -252,7 +252,7 @@ export class TeamWorkModel extends Stream<TeamWork>(ListModel) {
}

export class TeamAssignmentModel extends Stream<AwardAssignment>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/Activity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Base, createListStream, Filter, InputData, Media } from '../Base';
import { GitModel } from '../Git';
import { GitTemplateModal } from '../TemplateRepo';
import platformAdmin from '../User/PlatformAdmin';
import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';
import { AwardModel } from './Award';
import { Enrollment, EnrollmentModel } from './Enrollment';
import { LogModel } from './Log';
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface Questionnaire extends Base {
}

export class ActivityModel extends Stream<Activity, ActivityFilter>(ListModel) {
client = sessionStore.client;
client = strapiClient;
baseURI = 'hackathon';
indexKey = 'name' as const;

Expand Down
4 changes: 2 additions & 2 deletions models/Base/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HTTPError, Request, request } from 'koajax';
import { DataObject, toggle } from 'mobx-restful';
import { FileModel } from 'mobx-restful-table';

import sessionStore from '../User/Session';
import sessionStore, { strapiClient } from '../User/Session';
import { ErrorBaseData, UploadUrl } from './index';

export class AzureFileModel extends FileModel {
Expand Down Expand Up @@ -38,7 +38,7 @@ export class AzureFileModel extends FileModel {
async upload(file: File) {
const { type, name } = file;

const { body } = await sessionStore.client.post<UploadUrl>(
const { body } = await strapiClient.post<UploadUrl>(
`user/generateFileUrl`,
{
filename: name,
Expand Down
4 changes: 2 additions & 2 deletions models/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { averageOf } from 'web-utility';

import { TeamWork, TeamWorkType } from './Activity/Team';
import { Base, createListStream } from './Base';
import sessionStore from './User/Session';
import sessionStore, { strapiClient } from './User/Session';

type Repository = components['schemas']['repository'];

Expand Down Expand Up @@ -133,7 +133,7 @@ const DefaultTemplates = [
];

export class WorkspaceModel extends GitModel {
client = sessionStore.client;
client = strapiClient;

constructor(baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/TemplateRepo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ListModel, Stream, toggle } from 'mobx-restful';

import { Base, createListStream, InputData } from './Base';
import sessionStore from './User/Session';
import sessionStore, { strapiClient } from './User/Session';

export interface GitTemplate extends Base {
url: string;
Expand All @@ -14,7 +14,7 @@ export interface GitTemplate extends Base {
}

export class GitTemplateModal extends Stream<GitTemplate>(ListModel) {
client = sessionStore.client;
client = strapiClient;

constructor(public baseURI: string) {
super();
Expand Down
4 changes: 2 additions & 2 deletions models/User/PlatformAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IDType, ListModel, Stream, toggle } from 'mobx-restful';

import { HackathonAdmin } from '../Activity/Staff';
import { createListStream, Filter } from '../Base';
import sessionStore from './Session';
import sessionStore, { strapiClient } from './Session';

export type PlatformAdmin = HackathonAdmin;

Expand All @@ -13,7 +13,7 @@ export class PlatformAdminModel extends Stream<
PlatformAdmin,
PlatformAdminFilter
>(ListModel) {
client = sessionStore.client;
client = strapiClient;
baseURI = 'platform/admin';
indexKey = 'userId' as const;

Expand Down
4 changes: 2 additions & 2 deletions models/User/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ListModel, Stream } from 'mobx-restful';
import { buildURLData } from 'web-utility';

import { Base, createListStream, Filter, ListData } from '../Base';
import sessionStore from './Session';
import sessionStore, { strapiClient } from './Session';

export interface UserBase {
username: string;
Expand Down Expand Up @@ -126,7 +126,7 @@ export interface UserFilter extends Filter<User> {
}

export class UserModel extends Stream<User, UserFilter>(ListModel) {
client = sessionStore.client;
client = strapiClient;
baseURI = 'user';

async getUserTopList() {
Expand Down

1 comment on commit 4395950

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for open-hackathon ready!

✅ Preview
https://open-hackathon-pb0hj90gy-techquery.vercel.app

Built with commit 4395950.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.