Skip to content

Commit

Permalink
fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
theorm committed Jan 16, 2025
1 parent 0a47d48 commit 7e404d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
41 changes: 14 additions & 27 deletions src/models/articles.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const { getRegionCoordinatesFromDocument } = require('../util/solr')

const { getExternalFragment } = require('../hooks/iiif')

const ACCESS_RIGHT_NOT_SPECIFIED = 'na'
const ACCESS_RIGHT_OPEN_PRIVATE = 'OpenPrivate'
const ACCESS_RIGHT_CLOSED = 'Closed'
const ACCESS_RIGHT_OPEN_PUBLIC = 'OpenPublic'
export const ACCESS_RIGHT_NOT_SPECIFIED = 'na'
export const ACCESS_RIGHT_OPEN_PRIVATE = 'OpenPrivate'
export const ACCESS_RIGHT_CLOSED = 'Closed'
export const ACCESS_RIGHT_OPEN_PUBLIC = 'OpenPublic'

const ARTICLE_SOLR_FL_MINIMAL = ['id', 'item_type_s', 'doc_type_s']
export const ARTICLE_SOLR_FL_MINIMAL = ['id', 'item_type_s', 'doc_type_s']

const ARTICLE_SOLR_FL_LIST_ITEM = [
export const ARTICLE_SOLR_FL_LIST_ITEM = [
'id',
'lg_s', // 'fr',
'title_txt_fr',
Expand Down Expand Up @@ -65,7 +65,7 @@ const ARTICLE_SOLR_FL_LIST_ITEM = [
'rights_bm_get_img_l',
]

const ARTICLE_SOLR_FL_LITE = [
export const ARTICLE_SOLR_FL_LITE = [
'id',
'lg_s', // 'fr',
'content_txt_fr',
Expand Down Expand Up @@ -98,7 +98,7 @@ const ARTICLE_SOLR_FL_LITE = [
'loc_entities_dpfs',
]

const ARTICLE_SOLR_FL_TO_CSV = [
export const ARTICLE_SOLR_FL_TO_CSV = [
'id',
'lg_s', // 'fr',

Expand All @@ -125,9 +125,9 @@ const ARTICLE_SOLR_FL_TO_CSV = [
'loc_entities_dpfs',
]

const ARTICLE_SOLR_FL_SEARCH = ARTICLE_SOLR_FL_LITE.concat(['pp_plain:[json]'])
export const ARTICLE_SOLR_FL_SEARCH = ARTICLE_SOLR_FL_LITE.concat(['pp_plain:[json]'])

const ARTICLE_SOLR_FL = ARTICLE_SOLR_FL_LITE.concat([
export const ARTICLE_SOLR_FL = ARTICLE_SOLR_FL_LITE.concat([
'lb_plain:[json]',
'rb_plain:[json]',
'pp_plain:[json]',
Expand Down Expand Up @@ -188,7 +188,7 @@ class ArticleMatch extends Fragment {
}
}

class BaseArticle {
export class BaseArticle {
constructor({
uid = '',
type = '',
Expand Down Expand Up @@ -758,19 +758,6 @@ class Article extends BaseArticle {
}
}

// module.exports.SequelizeFactory = model;
module.exports = Article
module.exports.solrFactory = Article.solrFactory
module.exports.Model = Article
module.exports.BaseArticle = BaseArticle
module.exports.ARTICLE_SOLR_FL = ARTICLE_SOLR_FL
module.exports.ARTICLE_SOLR_FL_LITE = ARTICLE_SOLR_FL_LITE
module.exports.ARTICLE_SOLR_FL_SEARCH = ARTICLE_SOLR_FL_SEARCH
module.exports.ARTICLE_SOLR_FL_LIST_ITEM = ARTICLE_SOLR_FL_LIST_ITEM
module.exports.ARTICLE_SOLR_FL_TO_CSV = ARTICLE_SOLR_FL_TO_CSV
module.exports.ARTICLE_SOLR_FL_MINIMAL = ARTICLE_SOLR_FL_MINIMAL

module.exports.ACCESS_RIGHT_NOT_SPECIFIED = ACCESS_RIGHT_NOT_SPECIFIED
module.exports.ACCESS_RIGHT_OPEN_PRIVATE = ACCESS_RIGHT_OPEN_PRIVATE
module.exports.ACCESS_RIGHT_CLOSED = ACCESS_RIGHT_CLOSED
module.exports.ACCESS_RIGHT_OPEN_PUBLIC = ACCESS_RIGHT_OPEN_PUBLIC
export default Article
export const solrFactory = Article.solrFactory
export const Model = Article
8 changes: 4 additions & 4 deletions src/services/articles/articles.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Op } from 'sequelize'
import { NotFound } from '@feathersjs/errors'

import initSequelizeService, { Service as SequelizeService } from '../sequelize.service'
import Article from '../../models/articles.model'
import Article, { ARTICLE_SOLR_FL_LIST_ITEM } from '../../models/articles.model'
import Issue from '../../models/issues.model'
import { measureTime } from '../../util/instruments'
import { ImpressoApplication } from '../../types'
Expand Down Expand Up @@ -85,7 +85,7 @@ export class Service {
}

async _find(params: FindOptions) {
const fl = Article.ARTICLE_SOLR_FL_LIST_ITEM
const fl = ARTICLE_SOLR_FL_LIST_ITEM
const pageUids = (params.query.filters || []).filter(d => d.type === 'page').map(d => d.q)

debug('[find] use auth user:', params.user ? params.user.uid : 'no user')
Expand Down Expand Up @@ -148,7 +148,7 @@ export class Service {
article.pages = addonsIndex[article.uid].pages.map((d: any) => (d.constructor === Object ? d : d.toJSON()))
}
if (pageUids.length === 1) {
article.regions = article?.regions?.filter(r => pageUids.indexOf(r.pageUid) !== -1)
article.regions = article?.regions?.filter((r: { pageUid: string }) => pageUids.indexOf(r.pageUid) !== -1)
}
article.assignIIIF()
return article
Expand All @@ -158,7 +158,7 @@ export class Service {

async get(id: string, params: any) {
debug(`[get:${id}] with auth params:`, params.user ? params.user.uid : 'no user found')
const fl = Article.ARTICLE_SOLR_FL_LIST_ITEM.concat([
const fl = ARTICLE_SOLR_FL_LIST_ITEM.concat([
'lb_plain:[json]',
'rb_plain:[json]',
'pp_plain:[json]',
Expand Down

0 comments on commit 7e404d6

Please sign in to comment.