Skip to content
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

Minor fixes #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mongoose.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare module "mongoose" {
export interface Document {
save<T>(): Promise<void>;
save<T>(): Promise<void>
}
export interface PopulateOption {
populate?: PopulateOption;
populate?: PopulateOption
}
}
}
24 changes: 12 additions & 12 deletions src/pusher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ declare module "pusher" {

namespace pusher {
interface PusherStatic {
forURL(url: string): PusherClient;
forURL(url: string): PusherClient
}
interface PusherClient {
trigger(channel: string, event: string, data: any, socketId: string, callback: (err: Error) => void): void;
trigger(channels: string[], event: string, data: any, socketId: string, callback: (err: Error) => void): void;
trigger(channel: string, event: string, data: any, socketId: string, callback: (err: Error) => void): void
trigger(channels: string[], event: string, data: any, socketId: string, callback: (err: Error) => void): void
}
interface Config {
appId: string;
key: string;
secret: string;
encrypted?: boolean;
host?: string;
port?: number;
cluster?: string;
appId: string
key: string
secret: string
encrypted?: boolean
host?: string
port?: number
cluster?: string
}
}

var pusher: pusher.PusherStatic;
var pusher: pusher.PusherStatic

export = pusher;
export = pusher
}
151 changes: 75 additions & 76 deletions src/resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,65 @@ export declare module JSONApi {
}

export interface LinkObject {
href: string;
href: string
meta?: MetaObject
}

export interface LinksObject {
self?: string;
self?: string
}

export interface AttributesObject {

}

export interface ResourceIdentifierObject {
type: string;
id: string;
meta?: MetaObject;
type: string
id: string
meta?: MetaObject
}

export interface ToManyRelationshipsObject {
links?: LinksObject;
data: ResourceIdentifierObject[];
meta?: MetaObject;
links?: LinksObject
data: ResourceIdentifierObject[]
meta?: MetaObject
}

export interface ToOneRelationshipsObject {
links?: LinksObject;
data: ResourceIdentifierObject;
meta?: MetaObject;
links?: LinksObject
data: ResourceIdentifierObject
meta?: MetaObject
}

export interface RelationshipsDictionary {
[index: string]: ToOneRelationshipsObject | ToManyRelationshipsObject;
[index: string]: ToOneRelationshipsObject | ToManyRelationshipsObject
}

export interface ResourceObject {
links?: LinksObject;
type: string;
id?: string;
attributes?: AttributesObject;
relationships?: RelationshipsDictionary;
links?: LinksObject
type: string
id?: string
attributes?: AttributesObject
relationships?: RelationshipsDictionary
}

export interface ErrorObject {
id?: string;
links?: LinksObject;
status?: string;
code?: string;
title?: string;
detail?: string;
source?: string;
meta?: MetaObject;
id?: string
links?: LinksObject
status?: string
code?: string
title?: string
detail?: string
source?: string
meta?: MetaObject
}

export interface TopLevelDocument {
links?: LinksObject;
data?: ResourceObject | ResourceObject[];
errors?: ErrorObject[];
meta?: MetaObject;
included?: ResourceObject[];
links?: LinksObject
data?: ResourceObject | ResourceObject[]
errors?: ErrorObject[]
meta?: MetaObject
included?: ResourceObject[]
}
}

Expand All @@ -78,134 +78,133 @@ export declare module UserResource {
}

export interface ResourceObject extends JSONApi.ResourceObject {
attributes?: AttributesObject;
relationships?: RelationshipsDictionary;
attributes?: AttributesObject
relationships?: RelationshipsDictionary
}

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ResourceObject;
links?: JSONApi.LinksObject
data: ResourceObject
}

}

export declare module UsersResource {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links: JSONApi.LinksObject;
data: UserResource.ResourceObject[];
links: JSONApi.LinksObject
data: UserResource.ResourceObject[]
}

}

export declare module TeamResource {

export interface RelationshipsDictionary extends JSONApi.RelationshipsDictionary {
members: JSONApi.ToManyRelationshipsObject;
entries: JSONApi.ToManyRelationshipsObject;
members: JSONApi.ToManyRelationshipsObject
}

export interface AttributesObject extends JSONApi.AttributesObject {
name?: string;
motto?: string;
name?: string
motto?: string
}

export interface ResourceObject extends JSONApi.ResourceObject {
attributes?: AttributesObject;
relationships?: RelationshipsDictionary;
attributes?: AttributesObject
relationships?: RelationshipsDictionary
}

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ResourceObject;
links?: JSONApi.LinksObject
data: ResourceObject
}

}

export declare module TeamsResource {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: TeamResource.ResourceObject[];
links?: JSONApi.LinksObject
data: TeamResource.ResourceObject[]
}

}

export declare module TeamMembersRelationship {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: JSONApi.ResourceIdentifierObject[];
links?: JSONApi.LinksObject
data: JSONApi.ResourceIdentifierObject[]
}

}

export declare module TeamEntriesRelationship {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: JSONApi.ResourceIdentifierObject[];
links?: JSONApi.LinksObject
data: JSONApi.ResourceIdentifierObject[]
}

}

export declare module HackResource {

export interface AttributesObject extends JSONApi.AttributesObject {
name?: string;
name?: string
}

export interface ResourceObject extends JSONApi.ResourceObject {
attributes?: AttributesObject;
attributes?: AttributesObject
}

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ResourceObject;
links?: JSONApi.LinksObject
data: ResourceObject
}

}

export declare module HackChallengesRelationship {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: JSONApi.ResourceIdentifierObject[];
links?: JSONApi.LinksObject
data: JSONApi.ResourceIdentifierObject[]
}

}

export declare module HacksResource {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: HackResource.ResourceObject[];
links?: JSONApi.LinksObject
data: HackResource.ResourceObject[]
}

}

export declare module ChallengesResource {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ChallengeResource.ResourceObject[];
links?: JSONApi.LinksObject
data: ChallengeResource.ResourceObject[]
}

}

export declare module ChallengeResource {

export interface AttributesObject extends JSONApi.AttributesObject {
name?: string;
name?: string
}

export interface ResourceObject extends JSONApi.ResourceObject {
attributes?: AttributesObject;
attributes?: AttributesObject
}

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ResourceObject;
links?: JSONApi.LinksObject
data: ResourceObject
}

}
Expand All @@ -217,21 +216,21 @@ export declare module AttendeeResource {
}

export interface ResourceObject extends JSONApi.ResourceObject {
attributes?: AttributesObject;
attributes?: AttributesObject
}

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: ResourceObject;
links?: JSONApi.LinksObject
data: ResourceObject
}

}

export declare module AttendeesResource {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
links?: JSONApi.LinksObject;
data: AttendeeResource.ResourceObject[];
links?: JSONApi.LinksObject
data: AttendeeResource.ResourceObject[]
}

}
Expand All @@ -240,15 +239,15 @@ export declare module Root {

export interface TopLevelDocument extends JSONApi.TopLevelDocument {
jsonapi: {
version: string;
version: string
},
links: {
self: string;
teams: JSONApi.LinkObject;
users: JSONApi.LinkObject;
attendees: JSONApi.LinkObject;
hacks: JSONApi.LinkObject;
challenges: JSONApi.LinkObject;
self: string
teams: JSONApi.LinkObject
users: JSONApi.LinkObject
attendees: JSONApi.LinkObject
hacks: JSONApi.LinkObject
challenges: JSONApi.LinkObject
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/server/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export const ChallengeModel = model<ChallengeModel>('Challenge', ChallengeSchema

export interface Attendee {
attendeeid: string
slackid: string
}

export interface AttendeeModel extends Attendee, Document { }
interface AttendeeModel extends Attendee, Document { }

export const AttendeeSchema = new Schema({
attendeeid: { type: String, unique: true, required: true },
Expand Down
2 changes: 1 addition & 1 deletion src/server/plugins/admin-auth-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const register: PluginRegister = (server, pluginOptions: CustomOptions, next) =>
if (username !== pluginOptions.username || password !== pluginOptions.password) {
return callback(null, false)
}
callback(null, true, { username })
callback(null, true, { admin: true })
},
})

Expand Down
Loading